<ClCompile Include="..\..\src\object-enchant\protector\apply-magic-hard-armor.cpp" />\r
<ClCompile Include="..\..\src\object-enchant\weapon\abstract-weapon-enchanter.cpp" />\r
<ClCompile Include="..\..\src\object-use\quaff\quaff-effects.cpp" />\r
+ <ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-digging.cpp" />\r
<ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-sword.cpp" />\r
<ClCompile Include="..\..\src\object-use\read\gbh-shirt-read-executor.cpp" />\r
<ClCompile Include="..\..\src\object-use\read\parchment-read-executor.cpp" />\r
<ClInclude Include="..\..\src\object-enchant\protector\apply-magic-hard-armor.h" />\r
<ClInclude Include="..\..\src\object-enchant\weapon\abstract-weapon-enchanter.h" />\r
<ClInclude Include="..\..\src\object-use\quaff\quaff-effects.h" />\r
+ <ClInclude Include="..\..\src\object-enchant\weapon\apply-magic-digging.h" />\r
<ClInclude Include="..\..\src\object-enchant\weapon\apply-magic-sword.h" />\r
<ClInclude Include="..\..\src\object-use\read\gbh-shirt-read-executor.h" />\r
<ClInclude Include="..\..\src\object-use\read\parchment-read-executor.h" />\r
<ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-sword.cpp">\r
<Filter>object-enchant\weapon</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-digging.cpp">\r
+ <Filter>object-enchant\weapon</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\src\combat\shoot.h">\r
<ClInclude Include="..\..\src\object-enchant\weapon\apply-magic-sword.h">\r
<Filter>object-enchant\weapon</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\..\src\object-enchant\weapon\apply-magic-digging.h">\r
+ <Filter>object-enchant\weapon</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="..\..\src\wall.bmp" />\r
object-enchant/protector/apply-magic-soft-armor.cpp object-enchant/protector/apply-magic-soft-armor.h \
\
object-enchant/weapon/abstract-weapon-enchanter.cpp object-enchant/weapon/abstract-weapon-enchanter.h \
+ object-enchant/weapon/apply-magic-digging.cpp object-enchant/weapon/apply-magic-digging.h \
object-enchant/weapon/apply-magic-sword.cpp object-enchant/weapon/apply-magic-sword.h \
object-enchant/weapon/apply-magic-weapon.cpp object-enchant/weapon/apply-magic-weapon.h \
\
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
#include "object-enchant/trg-types.h"
+#include "object-enchant/weapon/apply-magic-digging.h"
#include "object-enchant/weapon/apply-magic-sword.h"
#include "object-enchant/weapon/apply-magic-weapon.h"
#include "object/object-kind.h"
// @todo ファクトリパターンで抽象化する.
switch (o_ptr->tval) {
case ItemKindType::DIGGING:
+ DiggingEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
+ break;
case ItemKindType::BOW:
case ItemKindType::SHOT:
case ItemKindType::ARROW:
--- /dev/null
+/*!
+ * @brief 掘削武器に耐性等の追加効果を付与する処理
+ * @date 2022/03/11
+ * @author Hourier
+ */
+
+#include "object-enchant/weapon/apply-magic-digging.h"
+#include "artifact/random-art-generator.h"
+#include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
+
+/*!
+ * @brief 掘削武器強化クラスのコンストラクタ
+ * @param player_ptr プレイヤーへの参照ポインタ
+ * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
+ * @param level 生成基準階
+ * @param power 生成ランク
+ */
+DiggingEnchanter::DiggingEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power)
+ : AbstractWeaponEnchanter(o_ptr, level, power)
+ , player_ptr(player_ptr)
+{
+}
+
+/*!
+ * @brief 掘削武器に生成ランクごとの強化を与えるサブルーチン
+ * @details power > 2はデバッグ専用.
+ */
+void DiggingEnchanter::apply_magic()
+{
+ if (this->should_skip) {
+ return;
+ }
+
+ if (this->power > 1) {
+ if ((this->power > 2) || one_in_(30)) {
+ become_random_artifact(this->player_ptr, this->o_ptr, false);
+ } else {
+ this->o_ptr->ego_idx = EgoType::DIGGING;
+ }
+
+ return;
+ }
+
+ if (this->power < -1) {
+ this->o_ptr->pval = 0 - (5 + randint1(5));
+ return;
+ }
+
+ if (this->power < 0) {
+ this->o_ptr->pval = 0 - (this->o_ptr->pval);
+ return;
+ }
+}
--- /dev/null
+#pragma once
+
+#include "object-enchant/weapon/abstract-weapon-enchanter.h"
+#include "system/angband.h"
+
+class ObjectType;
+class PlayerType;
+class DiggingEnchanter : AbstractWeaponEnchanter {
+public:
+ DiggingEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power);
+ void apply_magic() override;
+
+protected:
+ void sval_enchant() override{};
+ void give_ego_index() override{};
+ void give_high_ego_index() override{};
+ void give_cursed() override{};
+
+private:
+ PlayerType *player_ptr;
+};
}
switch (this->o_ptr->tval) {
- case ItemKindType::DIGGING: {
- if (this->power > 1) {
- if ((this->power > 2) || one_in_(30)) {
- become_random_artifact(this->player_ptr, this->o_ptr, false);
- } else {
- this->o_ptr->ego_idx = EgoType::DIGGING;
- }
- } else if (this->power < -1) {
- this->o_ptr->pval = 0 - (5 + randint1(5));
- } else if (this->power < 0) {
- this->o_ptr->pval = 0 - (this->o_ptr->pval);
- }
-
- break;
- }
case ItemKindType::BOW: {
if (this->power > 1) {
if ((this->power > 2) || one_in_(20)) {