<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-arrow.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
<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-arrow.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
<ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-digging.cpp">\r
<Filter>object-enchant\weapon</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\src\object-enchant\weapon\apply-magic-arrow.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-digging.h">\r
<Filter>object-enchant\weapon</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\..\src\object-enchant\weapon\apply-magic-arrow.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-arrow.cpp object-enchant/weapon/apply-magic-arrow.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-arrow.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"
DiggingEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
break;
case ItemKindType::BOW:
+ WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
+ break;
case ItemKindType::SHOT:
case ItemKindType::ARROW:
case ItemKindType::BOLT:
- WeaponEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
+ ArrowEnchanter(player_ptr, o_ptr, lev, power).apply_magic();
break;
case ItemKindType::HAFTED:
case ItemKindType::POLEARM:
--- /dev/null
+/*!
+ * @brief 矢類のアイテムを強化する処理
+ * @date 2022/03/11
+ * @author Hourier
+ */
+
+#include "object-enchant/weapon/apply-magic-arrow.h"
+#include "artifact/random-art-generator.h"
+#include "floor/floor-base-definitions.h"
+#include "inventory/inventory-slot-types.h"
+#include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
+
+/*!
+ * @brief 矢類強化クラスのコンストラクタ
+ * @param player_ptr プレイヤーへの参照ポインタ
+ * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
+ * @param level 生成基準階
+ * @param power 生成ランク
+ */
+ArrowEnchanter::ArrowEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH level, int power)
+ : AbstractWeaponEnchanter(o_ptr, level, power)
+ , player_ptr(player_ptr)
+{
+}
+
+/*!
+ * @brief 矢類に生成ランクごとの強化を与えるサブルーチン
+ * @details power > 2はデバッグ専用.
+ */
+void ArrowEnchanter::apply_magic()
+{
+ if (this->should_skip) {
+ return;
+ }
+
+ if (this->power > 1) {
+ if (this->power > 2) {
+ become_random_artifact(this->player_ptr, this->o_ptr, false);
+ return;
+ }
+
+ this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, true);
+ while (one_in_(10 * this->o_ptr->dd * this->o_ptr->ds)) {
+ this->o_ptr->dd++;
+ }
+
+ if (this->o_ptr->dd > 9) {
+ this->o_ptr->dd = 9;
+ }
+
+ return;
+ }
+
+ if (this->power < -1) {
+ if (randint0(MAX_DEPTH) < this->level) {
+ this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, false);
+ }
+ }
+}
--- /dev/null
+#pragma once
+
+#include "object-enchant/weapon/abstract-weapon-enchanter.h"
+#include "system/angband.h"
+
+class ObjectType;
+class PlayerType;
+class ArrowEnchanter : AbstractWeaponEnchanter {
+public:
+ ArrowEnchanter(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;
+};
return;
}
- switch (this->o_ptr->tval) {
- case ItemKindType::BOW: {
- if (this->power > 1) {
- if ((this->power > 2) || one_in_(20)) {
- become_random_artifact(this->player_ptr, this->o_ptr, false);
- break;
- }
-
- this->o_ptr->ego_idx = get_random_ego(INVEN_BOW, true);
- }
-
- break;
- }
- case ItemKindType::BOLT:
- case ItemKindType::ARROW:
- case ItemKindType::SHOT: {
- if (this->power > 1) {
- if (this->power > 2) {
- become_random_artifact(this->player_ptr, this->o_ptr, false);
- break;
- }
-
- this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, true);
- while (one_in_(10L * this->o_ptr->dd * this->o_ptr->ds)) {
- this->o_ptr->dd++;
- }
-
- if (this->o_ptr->dd > 9) {
- this->o_ptr->dd = 9;
- }
-
- break;
+ if (this->power > 1) {
+ if ((this->power > 2) || one_in_(20)) {
+ become_random_artifact(this->player_ptr, this->o_ptr, false);
+ return;
}
- if (this->power < -1) {
- if (randint0(MAX_DEPTH) < this->level) {
- this->o_ptr->ego_idx = get_random_ego(INVEN_AMMO, false);
- }
- }
-
- break;
- }
- default:
- break;
+ this->o_ptr->ego_idx = get_random_ego(INVEN_BOW, true);
}
}