<ClCompile Include="..\..\src\mind\surprise-attack.c" />\r
<ClCompile Include="..\..\src\object-enchant\apply-magic-accessory.c" />\r
<ClCompile Include="..\..\src\object-enchant\apply-magic-armor.c" />\r
+ <ClCompile Include="..\..\src\object-enchant\apply-magic-others.c" />\r
<ClCompile Include="..\..\src\object-enchant\apply-magic-weapon.c" />\r
<ClCompile Include="..\..\src\object\bow.c" />\r
<ClCompile Include="..\..\src\object\object-appraiser.c" />\r
<ClInclude Include="..\..\src\mind\surprise-attack.h" />\r
<ClInclude Include="..\..\src\object-enchant\apply-magic-accessory.h" />\r
<ClInclude Include="..\..\src\object-enchant\apply-magic-armor.h" />\r
+ <ClInclude Include="..\..\src\object-enchant\apply-magic-others.h" />\r
<ClInclude Include="..\..\src\object-enchant\apply-magic-weapon.h" />\r
<ClInclude Include="..\..\src\object\bow.h" />\r
<ClInclude Include="..\..\src\object\object-appraiser.h" />\r
<ClCompile Include="..\..\src\object-enchant\apply-magic-accessory.c">
<Filter>object-enchant</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\object-enchant\apply-magic-others.c">
+ <Filter>object-enchant</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\cmd\cmd-basic.h">
<ClInclude Include="..\..\src\object-enchant\apply-magic-accessory.h">
<Filter>object-enchant</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\object-enchant\apply-magic-others.h">
+ <Filter>object-enchant</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
\
object-enchant/apply-magic-accessory.c object-enchant/apply-magic-accessory.h \
object-enchant/apply-magic-armor.c object-enchant/apply-magic-armor.h \
+ object-enchant/apply-magic-others.c object-enchant/apply-magic-others.h \
object-enchant/apply-magic-weapon.c object-enchant/apply-magic-weapon.h \
object-enchant/artifact.c object-enchant/artifact.h \
object-enchant/object-boost.c object-enchant/object-boost.h \
--- /dev/null
+/*!
+ * todo ちょっと長い。要分割
+ * @brief 防具系のアイテムを強化して(恐らく床に)生成する処理
+ * @date 2020/06/02
+ * @author Hourier
+ */
+
+#include "object-enchant/apply-magic-others.h"
+#include "floor/floor.h"
+#include "monster/monster-race-hook.h"
+#include "object-enchant/artifact.h"
+#include "object-enchant/object-ego.h"
+#include "object-enchant/trc-types.h"
+#include "object/object-appraiser.h"
+#include "object/object-kind.h"
+#include "sv-definition/sv-lite-types.h"
+#include "sv-definition/sv-other-types.h"
+
+/*!
+ * @brief その他雑多のオブジェクトに生成ランクごとの強化を与えるサブルーチン
+ * Apply magic to an item known to be "boring"
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
+ * @param power 生成ランク
+ * @return なし
+ * @details
+ * Hack -- note the special code for various items
+ */
+void apply_magic_others(player_type *owner_ptr, object_type *o_ptr, int power)
+{
+ object_kind *k_ptr = &k_info[o_ptr->k_idx];
+
+ floor_type *floor_ptr = owner_ptr->current_floor_ptr;
+ switch (o_ptr->tval) {
+ case TV_WHISTLE: {
+ break;
+ }
+ case TV_FLASK: {
+ o_ptr->xtra4 = o_ptr->pval;
+ o_ptr->pval = 0;
+ break;
+ }
+ case TV_LITE: {
+ if (o_ptr->sval == SV_LITE_TORCH) {
+ if (o_ptr->pval > 0)
+ o_ptr->xtra4 = randint1(o_ptr->pval);
+ o_ptr->pval = 0;
+ }
+
+ if (o_ptr->sval == SV_LITE_LANTERN) {
+ if (o_ptr->pval > 0)
+ o_ptr->xtra4 = randint1(o_ptr->pval);
+ o_ptr->pval = 0;
+ }
+
+ /* power > 2 is debug only */
+ if (power > 2) {
+ become_random_artifact(owner_ptr, o_ptr, FALSE);
+ } else if ((power == 2) || ((power == 1) && one_in_(3))) {
+ while (!o_ptr->name2) {
+ while (TRUE) {
+ bool okay_flag = TRUE;
+
+ o_ptr->name2 = get_random_ego(INVEN_LITE, TRUE);
+
+ switch (o_ptr->name2) {
+ case EGO_LITE_LONG:
+ if (o_ptr->sval == SV_LITE_FEANOR)
+ okay_flag = FALSE;
+ }
+
+ if (okay_flag)
+ break;
+ }
+ }
+ } else if (power == -2) {
+ o_ptr->name2 = get_random_ego(INVEN_LITE, FALSE);
+ switch (o_ptr->name2) {
+ case EGO_LITE_DARKNESS:
+ o_ptr->xtra4 = 0;
+
+ if (o_ptr->sval == SV_LITE_TORCH) {
+ add_flag(o_ptr->art_flags, TR_LITE_M1);
+ } else if (o_ptr->sval == SV_LITE_LANTERN) {
+ add_flag(o_ptr->art_flags, TR_LITE_M2);
+ } else if (o_ptr->sval == SV_LITE_FEANOR) {
+ add_flag(o_ptr->art_flags, TR_LITE_M3);
+ }
+ break;
+ }
+ }
+
+ break;
+ }
+ case TV_WAND:
+ case TV_STAFF: {
+ /* The wand or staff gets a number of initial charges equal
+ * to between 1/2 (+1) and the full object kind's pval. -LM-
+ */
+ o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
+ break;
+ }
+ case TV_ROD: {
+ o_ptr->pval = k_ptr->pval;
+ break;
+ }
+ case TV_CAPTURE: {
+ o_ptr->pval = 0;
+ object_aware(owner_ptr, o_ptr);
+ object_known(o_ptr);
+ break;
+ }
+ case TV_FIGURINE: {
+ PARAMETER_VALUE i = 1;
+ int check;
+ monster_race *r_ptr;
+ while (TRUE) {
+ i = randint1(max_r_idx - 1);
+
+ if (!item_monster_okay(i))
+ continue;
+ if (i == MON_TSUCHINOKO)
+ continue;
+
+ r_ptr = &r_info[i];
+ check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
+ if (!r_ptr->rarity)
+ continue;
+ if (r_ptr->rarity > 100)
+ continue;
+ if (randint0(check))
+ continue;
+
+ break;
+ }
+
+ o_ptr->pval = i;
+ if (one_in_(6))
+ o_ptr->curse_flags |= TRC_CURSED;
+
+ break;
+ }
+ case TV_CORPSE: {
+ PARAMETER_VALUE i = 1;
+ int check;
+ u32b match = 0;
+ monster_race *r_ptr;
+ if (o_ptr->sval == SV_SKELETON) {
+ match = RF9_DROP_SKELETON;
+ } else if (o_ptr->sval == SV_CORPSE) {
+ match = RF9_DROP_CORPSE;
+ }
+
+ get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
+ while (TRUE) {
+ i = get_mon_num(owner_ptr, floor_ptr->dun_level, 0);
+ r_ptr = &r_info[i];
+ check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
+ if (!r_ptr->rarity)
+ continue;
+ if (!(r_ptr->flags9 & match))
+ continue;
+ if (randint0(check))
+ continue;
+
+ break;
+ }
+
+ o_ptr->pval = i;
+ object_aware(owner_ptr, o_ptr);
+ object_known(o_ptr);
+ break;
+ }
+ case TV_STATUE: {
+ PARAMETER_VALUE i = 1;
+ monster_race *r_ptr;
+ while (TRUE) {
+ i = randint1(max_r_idx - 1);
+ r_ptr = &r_info[i];
+ if (!r_ptr->rarity)
+ continue;
+
+ break;
+ }
+
+ o_ptr->pval = i;
+ if (cheat_peek) {
+ msg_format(_("%sの像", "Statue of %s"), r_name + r_ptr->name);
+ }
+
+ object_aware(owner_ptr, o_ptr);
+ object_known(o_ptr);
+ break;
+ }
+ case TV_CHEST: {
+ DEPTH obj_level = k_info[o_ptr->k_idx].level;
+ if (obj_level <= 0)
+ break;
+
+ o_ptr->pval = randint1(obj_level);
+ if (o_ptr->sval == SV_CHEST_KANDUME)
+ o_ptr->pval = 6;
+
+ o_ptr->xtra3 = floor_ptr->dun_level + 5;
+ if (o_ptr->pval > 55)
+ o_ptr->pval = 55 + (byte)randint0(5);
+
+ break;
+ }
+ }
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+void apply_magic_others(player_type *owner_ptr, object_type *o_ptr, int power);
#include "monster/monster.h"
#include "object-enchant/apply-magic-accessory.h"
#include "object-enchant/apply-magic-armor.h"
+#include "object-enchant/apply-magic-others.h"
#include "object-enchant/apply-magic-weapon.h"
#include "object-enchant/artifact.h"
#include "object-enchant/item-apply-magic.h"
/*!
- * @brief その他雑多のオブジェクトに生成ランクごとの強化を与えるサブルーチン
- * Apply magic to an item known to be "boring"
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
- * @param power 生成ランク
- * @return なし
- * @details
- * Hack -- note the special code for various items
- */
-static void apply_magic_others(player_type *owner_ptr, object_type *o_ptr, int power)
-{
- object_kind *k_ptr = &k_info[o_ptr->k_idx];
-
- floor_type *floor_ptr = owner_ptr->current_floor_ptr;
- switch (o_ptr->tval)
- {
- case TV_WHISTLE:
- {
- break;
- }
- case TV_FLASK:
- {
- o_ptr->xtra4 = o_ptr->pval;
- o_ptr->pval = 0;
- break;
- }
- case TV_LITE:
- {
- if (o_ptr->sval == SV_LITE_TORCH)
- {
- if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
- o_ptr->pval = 0;
- }
-
- if (o_ptr->sval == SV_LITE_LANTERN)
- {
- if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
- o_ptr->pval = 0;
- }
-
- /* power > 2 is debug only */
- if (power > 2)
- {
- become_random_artifact(owner_ptr, o_ptr, FALSE);
- }
- else if ((power == 2) || ((power == 1) && one_in_(3)))
- {
- while (!o_ptr->name2)
- {
- while (TRUE)
- {
- bool okay_flag = TRUE;
-
- o_ptr->name2 = get_random_ego(INVEN_LITE, TRUE);
-
- switch (o_ptr->name2)
- {
- case EGO_LITE_LONG:
- if (o_ptr->sval == SV_LITE_FEANOR)
- okay_flag = FALSE;
- }
-
- if (okay_flag)
- break;
- }
- }
- }
- else if (power == -2)
- {
- o_ptr->name2 = get_random_ego(INVEN_LITE, FALSE);
- switch (o_ptr->name2)
- {
- case EGO_LITE_DARKNESS:
- o_ptr->xtra4 = 0;
-
- if (o_ptr->sval == SV_LITE_TORCH)
- {
- add_flag(o_ptr->art_flags, TR_LITE_M1);
- }
- else if (o_ptr->sval == SV_LITE_LANTERN)
- {
- add_flag(o_ptr->art_flags, TR_LITE_M2);
- }
- else if (o_ptr->sval == SV_LITE_FEANOR)
- {
- add_flag(o_ptr->art_flags, TR_LITE_M3);
- }
- break;
- }
- }
-
- break;
- }
- case TV_WAND:
- case TV_STAFF:
- {
- /* The wand or staff gets a number of initial charges equal
- * to between 1/2 (+1) and the full object kind's pval. -LM-
- */
- o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
- break;
- }
- case TV_ROD:
- {
- o_ptr->pval = k_ptr->pval;
- break;
- }
- case TV_CAPTURE:
- {
- o_ptr->pval = 0;
- object_aware(owner_ptr, o_ptr);
- object_known(o_ptr);
- break;
- }
- case TV_FIGURINE:
- {
- PARAMETER_VALUE i = 1;
- int check;
- monster_race *r_ptr;
- while (TRUE)
- {
- i = randint1(max_r_idx - 1);
-
- if (!item_monster_okay(i)) continue;
- if (i == MON_TSUCHINOKO) continue;
-
- r_ptr = &r_info[i];
- check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
- if (!r_ptr->rarity) continue;
- if (r_ptr->rarity > 100) continue;
- if (randint0(check)) continue;
-
- break;
- }
-
- o_ptr->pval = i;
- if (one_in_(6)) o_ptr->curse_flags |= TRC_CURSED;
-
- break;
- }
- case TV_CORPSE:
- {
- PARAMETER_VALUE i = 1;
- int check;
- u32b match = 0;
- monster_race *r_ptr;
- if (o_ptr->sval == SV_SKELETON)
- {
- match = RF9_DROP_SKELETON;
- }
- else if (o_ptr->sval == SV_CORPSE)
- {
- match = RF9_DROP_CORPSE;
- }
-
- get_mon_num_prep(owner_ptr, item_monster_okay, NULL);
- while (TRUE)
- {
- i = get_mon_num(owner_ptr, floor_ptr->dun_level, 0);
- r_ptr = &r_info[i];
- check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
- if (!r_ptr->rarity) continue;
- if (!(r_ptr->flags9 & match)) continue;
- if (randint0(check)) continue;
-
- break;
- }
-
- o_ptr->pval = i;
- object_aware(owner_ptr, o_ptr);
- object_known(o_ptr);
- break;
- }
- case TV_STATUE:
- {
- PARAMETER_VALUE i = 1;
- monster_race *r_ptr;
- while (TRUE)
- {
- i = randint1(max_r_idx - 1);
- r_ptr = &r_info[i];
- if (!r_ptr->rarity) continue;
-
- break;
- }
-
- o_ptr->pval = i;
- if (cheat_peek)
- {
- msg_format(_("%sの像", "Statue of %s"), r_name + r_ptr->name);
- }
-
- object_aware(owner_ptr, o_ptr);
- object_known(o_ptr);
- break;
- }
- case TV_CHEST:
- {
- DEPTH obj_level = k_info[o_ptr->k_idx].level;
- if (obj_level <= 0) break;
-
- o_ptr->pval = randint1(obj_level);
- if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6;
-
- o_ptr->xtra3 = floor_ptr->dun_level + 5;
- if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5);
-
- break;
- }
- }
-}
-
-
-/*!
* @brief 生成されたベースアイテムに魔法的な強化を与えるメインルーチン
* Complete the "creation" of an object by applying "magic" to the item
* @param owner_ptr プレーヤーへの参照ポインタ