OSDN Git Service

[Refactor] #3736 activation_type のフィールド変数をconcptr からstring に差し替えた
[hengbandforosx/hengbandosx.git] / src / object-enchant / enchanter-factory.cpp
1 /*!
2  * @brief アイテムの強化/弱化処理クラスを選択するファクトリクラス
3  * @date 2022/03/22
4  * @author Hourier
5  */
6
7 #include "object-enchant/enchanter-factory.h"
8 #include "object-enchant/others/apply-magic-amulet.h"
9 #include "object-enchant/others/apply-magic-lite.h"
10 #include "object-enchant/others/apply-magic-others.h"
11 #include "object-enchant/others/apply-magic-ring.h"
12 #include "object-enchant/protector/apply-magic-armor.h"
13 #include "object-enchant/protector/apply-magic-boots.h"
14 #include "object-enchant/protector/apply-magic-cloak.h"
15 #include "object-enchant/protector/apply-magic-crown.h"
16 #include "object-enchant/protector/apply-magic-dragon-armor.h"
17 #include "object-enchant/protector/apply-magic-gloves.h"
18 #include "object-enchant/protector/apply-magic-hard-armor.h"
19 #include "object-enchant/protector/apply-magic-helm.h"
20 #include "object-enchant/protector/apply-magic-shield.h"
21 #include "object-enchant/protector/apply-magic-soft-armor.h"
22 #include "object-enchant/weapon/apply-magic-arrow.h"
23 #include "object-enchant/weapon/apply-magic-bow.h"
24 #include "object-enchant/weapon/apply-magic-digging.h"
25 #include "object-enchant/weapon/apply-magic-hafted.h"
26 #include "object-enchant/weapon/apply-magic-polearm.h"
27 #include "object-enchant/weapon/apply-magic-sword.h"
28 #include "object/tval-types.h"
29 #include "system/item-entity.h"
30
31 std::unique_ptr<EnchanterBase> EnchanterFactory::create_enchanter(PlayerType *player_ptr, ItemEntity *o_ptr, int lev, int power)
32 {
33     switch (o_ptr->bi_key.tval()) {
34     case ItemKindType::SHOT:
35     case ItemKindType::ARROW:
36     case ItemKindType::BOLT:
37         return std::make_unique<ArrowEnchanter>(player_ptr, o_ptr, lev, power);
38     case ItemKindType::BOW:
39         return std::make_unique<BowEnchanter>(player_ptr, o_ptr, lev, power);
40     case ItemKindType::DIGGING:
41         return std::make_unique<DiggingEnchanter>(player_ptr, o_ptr, lev, power);
42     case ItemKindType::HAFTED:
43         return std::make_unique<HaftedEnchanter>(player_ptr, o_ptr, lev, power);
44     case ItemKindType::POLEARM:
45         return std::make_unique<PolearmEnchanter>(player_ptr, o_ptr, lev, power);
46     case ItemKindType::SWORD:
47         return std::make_unique<SwordEnchanter>(player_ptr, o_ptr, lev, power);
48     case ItemKindType::BOOTS:
49         return std::make_unique<BootsEnchanter>(player_ptr, o_ptr, lev, power);
50     case ItemKindType::GLOVES:
51         return std::make_unique<GlovesEnchanter>(player_ptr, o_ptr, lev, power);
52     case ItemKindType::HELM:
53         return std::make_unique<HelmEnchanter>(player_ptr, o_ptr, lev, power);
54     case ItemKindType::CROWN:
55         return std::make_unique<CrownEnchanter>(player_ptr, o_ptr, lev, power);
56     case ItemKindType::SHIELD:
57         return std::make_unique<ShieldEnchanter>(player_ptr, o_ptr, lev, power);
58     case ItemKindType::CLOAK:
59         return std::make_unique<CloakEnchanter>(player_ptr, o_ptr, lev, power);
60     case ItemKindType::SOFT_ARMOR:
61         return std::make_unique<SoftArmorEnchanter>(player_ptr, o_ptr, lev, power);
62     case ItemKindType::HARD_ARMOR:
63         return std::make_unique<HardArmorEnchanter>(player_ptr, o_ptr, lev, power);
64     case ItemKindType::DRAG_ARMOR:
65         return std::make_unique<DragonArmorEnchanter>(player_ptr, o_ptr, lev, power);
66     case ItemKindType::LITE:
67         return std::make_unique<LiteEnchanter>(player_ptr, o_ptr, power);
68     case ItemKindType::AMULET:
69         return std::make_unique<AmuletEnchanter>(player_ptr, o_ptr, lev, power);
70     case ItemKindType::RING:
71         return std::make_unique<RingEnchanter>(player_ptr, o_ptr, lev, power);
72     default:
73         return std::make_unique<OtherItemsEnchanter>(player_ptr, o_ptr);
74     }
75 }