2 * @brief 防具系のアイテムを強化して(恐らく床に)生成する処理
8 #include "object-enchant/others/apply-magic-others.h"
9 #include "artifact/random-art-generator.h"
10 #include "game-option/cheat-options.h"
11 #include "inventory/inventory-slot-types.h"
12 #include "monster-race/monster-race-hook.h"
13 #include "monster-race/monster-race.h"
14 #include "monster-race/race-flags9.h"
15 #include "monster-race/race-indice-types.h"
16 #include "monster/monster-list.h"
17 #include "monster/monster-util.h"
18 #include "object-enchant/object-ego.h"
19 #include "object-enchant/tr-types.h"
20 #include "object-enchant/trc-types.h"
21 #include "object/object-kind.h"
22 #include "perception/object-perception.h"
23 #include "sv-definition/sv-lite-types.h"
24 #include "sv-definition/sv-other-types.h"
25 #include "system/floor-type-definition.h"
26 #include "system/monster-race-definition.h"
27 #include "system/object-type-definition.h"
28 #include "system/player-type-definition.h"
29 #include "util/bit-flags-calculator.h"
30 #include "view/display-messages.h"
33 * @brief その他雑多のオブジェクトに生成ランクごとの強化を与えるサブルーチン
34 * Apply magic to an item known to be "boring"
35 * @param player_ptr プレイヤーへの参照ポインタ
36 * @param o_ptr 強化を与えたいオブジェクトの構造体参照ポインタ
38 * @details power > 2はデバッグ専用.
40 void apply_magic_others(PlayerType *player_ptr, ObjectType *o_ptr, int power)
42 auto *k_ptr = &k_info[o_ptr->k_idx];
44 auto *floor_ptr = player_ptr->current_floor_ptr;
45 switch (o_ptr->tval) {
46 case ItemKindType::WHISTLE: {
49 case ItemKindType::FLASK: {
50 o_ptr->xtra4 = o_ptr->pval;
54 case ItemKindType::WAND:
55 case ItemKindType::STAFF: {
56 /* The wand or staff gets a number of initial charges equal
57 * to between 1/2 (+1) and the full object kind's pval. -LM-
59 o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
62 case ItemKindType::ROD: {
63 o_ptr->pval = k_ptr->pval;
66 case ItemKindType::CAPTURE: {
68 object_aware(player_ptr, o_ptr);
72 case ItemKindType::FIGURINE: {
73 PARAMETER_VALUE i = 1;
77 i = randint1(r_info.size() - 1);
79 if (!item_monster_okay(player_ptr, i))
81 if (i == MON_TSUCHINOKO)
85 check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
88 if (r_ptr->rarity > 100)
98 o_ptr->curse_flags.set(CurseTraitType::CURSED);
102 case ItemKindType::CORPSE: {
103 PARAMETER_VALUE i = 1;
107 if (o_ptr->sval == SV_SKELETON) {
108 match = RF9_DROP_SKELETON;
109 } else if (o_ptr->sval == SV_CORPSE) {
110 match = RF9_DROP_CORPSE;
113 get_mon_num_prep(player_ptr, item_monster_okay, nullptr);
115 i = get_mon_num(player_ptr, 0, floor_ptr->dun_level, 0);
117 check = (floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - floor_ptr->dun_level) : 0;
120 if (!(r_ptr->flags9 & match))
129 object_aware(player_ptr, o_ptr);
133 case ItemKindType::STATUE: {
134 PARAMETER_VALUE i = 1;
137 i = randint1(r_info.size() - 1);
147 msg_format(_("%sの像", "Statue of %s"), r_ptr->name.c_str());
150 object_aware(player_ptr, o_ptr);
154 case ItemKindType::CHEST: {
155 DEPTH obj_level = k_info[o_ptr->k_idx].level;
159 o_ptr->pval = randint1(obj_level);
160 if (o_ptr->sval == SV_CHEST_KANDUME)
163 o_ptr->xtra3 = floor_ptr->dun_level + 5;
164 if (o_ptr->pval > 55)
165 o_ptr->pval = 55 + (byte)randint0(5);