OSDN Git Service

#37287 #37353 (2.2.0.89) idx型とhit_prob型を定義し、型の置換を継続中。 / Define typedef idx and hit_pr...
[hengband/hengband.git] / src / object2.c
index 2ad34a1..b51a646 100644 (file)
 
 #include "angband.h"
 
-#include "kajitips.h"
+static cptr const kaji_tips[5] =
+{
+#ifdef JP
+       "現在持っているエッセンスの一覧を表示する。",
+       "アイテムからエッセンスを取り出す。エッセンスを取られたアイテムは全く魔法がかかっていない初期状態に戻る。",
+       "既にエッセンスが付加されたアイテムからエッセンスのみ消し去る。エッセンスは手に入らない。",
+       "アイテムにエッセンスを付加する。既にエッセンスが付加されたアイテムやアーティファクトには付加できない。",
+       "武器や防具を強化したり、攻撃で傷つかないようにしたりする。エッセンスが付加されたアイテムやアーティファクトに対しても使用できる。",
+#else
+       "Display essences you have.",
+       "Extract essences from an item. The item become non magical.",
+       "Remove added essences from an equipment which was improved before. The removed essence will be ruined.",
+       "Add essences to an item. The improved items or artifacts cannot be reimprove.",
+       "Enchant an equipment or make an equiment element-proofed. The improved items and artifacts can be enchanted too.",
+#endif
+};
 
 /*!
  * @brief 床上、モンスター所持でスタックされたアイテムを削除しスタックを補完する / Excise a dungeon object from any stacks
@@ -397,7 +412,7 @@ void compact_objects(int size)
                        }
 
                        /* Nearby objects start out "immune" */
-                       if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue;
+                       if ((cur_dis > 0) && (distance(p_ptr->y, p_ptr->x, y, x) < cur_dis)) continue;
 
                        /* Saving throw */
                        chance = 90;
@@ -2064,28 +2079,15 @@ static void object_mention(object_type *o_ptr)
 {
        char o_name[MAX_NLEN];
 
-       /*!
-        * @note アイテム名取得後アイテムの価値に応じたデバッグメッセージを出力する。
-        * Get Describe and view, Artifact, Random Artifact, Ego-item, and Normal item.
-        */
-       object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
+       object_aware(o_ptr);
+       object_known(o_ptr);
 
-       if (object_is_fixed_artifact(o_ptr))
-       {
-               msg_format(_("伝説のアイテム (%s)", "Artifact (%s)"), o_name);
-       }
-       else if (o_ptr->art_name)
-       {
-               msg_print(_("ランダム・アーティファクト", "Random artifact"));
-       }
-       else if (object_is_ego(o_ptr))
-       {
-               msg_format(_("名のあるアイテム (%s)", "Ego-item (%s)"), o_name);
-       }
-       else
-       {
-               msg_format(_("アイテム (%s)", "Object (%s)"), o_name);
-       }
+       /* Mark the item as fully known */
+       o_ptr->ident |= (IDENT_MENTAL);
+
+       /* Description */
+       object_desc(o_name, o_ptr, 0);
+       msg_format_wizard(CHEAT_OBJECT, _("%sを生成しました。", "%s was generated."), o_name);
 }
 
 /*!
@@ -2283,11 +2285,11 @@ static byte get_random_ego(byte slot, bool good)
  */
 static void a_m_aux_1(object_type *o_ptr, int level, int power)
 {
-       int tohit1 = randint1(5) + m_bonus(5, level);
-       int todam1 = randint1(5) + m_bonus(5, level);
+       hit_prob tohit1 = randint1(5) + m_bonus(5, level);
+       hit_point todam1 = randint1(5) + m_bonus(5, level);
 
-       int tohit2 = m_bonus(10, level);
-       int todam2 = m_bonus(10, level);
+       hit_prob tohit2 = m_bonus(10, level);
+       hit_point todam2 = m_bonus(10, level);
 
        if ((o_ptr->tval == TV_BOLT) || (o_ptr->tval == TV_ARROW) || (o_ptr->tval == TV_SHOT))
        {
@@ -2714,10 +2716,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (one_in_(50) || (power > 2)) /* power > 2 is debug only */
                                create_artifact(o_ptr, FALSE);
-
-                       /* Mention the item */
-                       if (cheat_peek) object_mention(o_ptr);
-
                        break;
                }
 
@@ -2761,24 +2759,23 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
 
                                        switch (o_ptr->name2)
                                        {
-                                         case EGO_DWARVEN:
-                                               if (o_ptr->tval != TV_HARD_ARMOR)
-                                               {
-                                                       okay_flag = FALSE;
-                                                       break;
-                                               }
-                                         case EGO_DRUID:
-                                               if (o_ptr->tval != TV_SOFT_ARMOR)
-                                               {
-                                                       okay_flag = FALSE;
-                                                       break;
-                                               }
-                                         default:
+                                               case EGO_DWARVEN:
+                                                       if (o_ptr->tval != TV_HARD_ARMOR)
+                                                       {
+                                                               okay_flag = FALSE;
+                                                       }
+                                               break;
+                                               case EGO_DRUID:
+                                                       if (o_ptr->tval != TV_SOFT_ARMOR)
+                                                       {
+                                                               okay_flag = FALSE;
+                                                       }
+                                               break;
+                                               default:
                                                break;
                                        }
 
-                                       if (okay_flag)
-                                               break;
+                                       if (okay_flag) break;
                                }
                                switch (o_ptr->name2)
                                {
@@ -2829,8 +2826,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
 
                        if (o_ptr->sval == SV_DRAGON_SHIELD)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -2879,8 +2874,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_SET_OF_DRAGON_GLOVES)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -2907,8 +2900,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -3015,8 +3006,6 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        if (o_ptr->sval == SV_DRAGON_HELM)
                        {
-                               /* Mention the item */
-                               if (cheat_peek) object_mention(o_ptr);
                                dragon_resist(o_ptr);
                                if (!one_in_(3)) break;
                        }
@@ -3136,6 +3125,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        break;
                }
        }
+
 }
 
 
@@ -3236,9 +3226,6 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                                break;
                                        }
 
-                                       /* Mention the item */
-                                       if (cheat_peek) object_mention(o_ptr);
-
                                        break;
                                }
 
@@ -3743,9 +3730,6 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        /* gain one low ESP */
                                        add_esp_weak(o_ptr, FALSE);
 
-                                       /* Mention the item */
-                                       if (cheat_peek) object_mention(o_ptr);
-
                                        break;
                                }
 
@@ -4128,13 +4112,6 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                        /* Some figurines are cursed */
                        if (one_in_(6)) o_ptr->curse_flags |= TRC_CURSED;
 
-                       if (cheat_peek)
-                       {
-                               msg_format(_("%sの人形, 深さ +%d%s", "Figurine of %s, depth +%d%s"),
-                                                         r_name + r_ptr->name, check - 1,
-                                                         !object_is_cursed(o_ptr) ? "" : " {cursed}");
-                       }
-
                        break;
                }
 
@@ -4182,11 +4159,6 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
 
                        o_ptr->pval = i;
 
-                       if (cheat_peek)
-                       {
-                               msg_format(_("%sの死体, 深さ +%d", "Corpse of %s, depth +%d"),
-                                                         r_name + r_ptr->name, check - 1);
-                       }
 
                        object_aware(o_ptr);
                        object_known(o_ptr);
@@ -4424,10 +4396,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr);
                if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr);
 
-
-               /* Cheat -- peek at the item */
-               if (cheat_peek) object_mention(o_ptr);
-
                /* Done */
                return;
        }
@@ -4664,9 +4632,6 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                        if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS))
                                o_ptr->pval = 2;
                }
-
-               /* Cheat -- describe the item */
-               if (cheat_peek) object_mention(o_ptr);
                
                /* Done */
                return;
@@ -4688,6 +4653,8 @@ void apply_magic(object_type *o_ptr, int lev, u32b mode)
                if (k_ptr->gen_flags & (TRG_RANDOM_CURSE1)) o_ptr->curse_flags |= get_curse(1, o_ptr);
                if (k_ptr->gen_flags & (TRG_RANDOM_CURSE2)) o_ptr->curse_flags |= get_curse(2, o_ptr);
        }
+
+       
 }
 
 
@@ -4855,13 +4822,7 @@ bool make_object(object_type *j_ptr, u32b mode)
        obj_level = k_info[j_ptr->k_idx].level;
        if (object_is_fixed_artifact(j_ptr)) obj_level = a_info[j_ptr->name1].level;
 
-       /* Notice "okay" out-of-depth objects */
-       if (!object_is_cursed(j_ptr) && !object_is_broken(j_ptr) &&
-           (obj_level > dun_level))
-       {
-               /* Cheat -- peek at items */
-               if (cheat_peek) object_mention(j_ptr);
-       }
+       if (cheat_peek) object_mention(j_ptr);
 
        /* Success */
        return (TRUE);
@@ -4880,9 +4841,9 @@ bool make_object(object_type *j_ptr, u32b mode)
  * This routine uses "object_level" for the "generation level".\n
  * This routine requires a clean floor grid destination.\n
  */
-void place_object(int y, int x, u32b mode)
+void place_object(position y, position x, u32b mode)
 {
-       s16b o_idx;
+       idx o_idx;
 
        /* Acquire grid */
        cave_type *c_ptr = &cave[y][x];
@@ -5005,7 +4966,7 @@ bool make_gold(object_type *j_ptr)
  * @details
  * The location must be a legal, clean, floor grid.
  */
-void place_gold(int y, int x)
+void place_gold(position y, position x)
 {
        s16b o_idx;
 
@@ -6465,7 +6426,7 @@ void inven_drop(int item, int amt)
        msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(item));
 
        /* Drop it near the player */
-       (void)drop_near(q_ptr, 0, py, px);
+       (void)drop_near(q_ptr, 0, p_ptr->y, p_ptr->x);
 
        /* Modify, Describe, Optimize */
        inven_item_increase(item, -amt);
@@ -7147,8 +7108,8 @@ bool process_warning(int xx, int yy)
                        if (projectable(my, mx, yy, xx))
             {
                                u32b f4 = r_ptr->flags4;
-                               u32b f5 = r_ptr->flags5;
-                               u32b f6 = r_ptr->flags6;
+                               u32b f5 = r_ptr->a_ability_flags1;
+                               u32b f6 = r_ptr->a_ability_flags2;
 
                                if (!(d_info[dungeon_type].flags1 & DF1_NO_MAGIC))
                                {
@@ -7174,7 +7135,7 @@ bool process_warning(int xx, int yy)
                 if (f4 & RF4_BR_DISE) spell_damcalc_by_spellnum(MS_BR_DISEN, GF_DISENCHANT, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_NEXU) spell_damcalc_by_spellnum(MS_BR_NEXUS, GF_NEXUS, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_TIME) spell_damcalc_by_spellnum(MS_BR_TIME, GF_TIME, c_ptr->m_idx, &dam_max0);
-                if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(MS_BR_INERTIA, GF_INERTIA, c_ptr->m_idx, &dam_max0);
+                if (f4 & RF4_BR_INER) spell_damcalc_by_spellnum(MS_BR_INERTIA, GF_INERTIAL, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_GRAV) spell_damcalc_by_spellnum(MS_BR_GRAVITY, GF_GRAVITY, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_SHAR) spell_damcalc_by_spellnum(MS_BR_SHARDS, GF_SHARDS, c_ptr->m_idx, &dam_max0);
                 if (f4 & RF4_BR_PLAS) spell_damcalc_by_spellnum(MS_BR_PLASMA, GF_PLASMA, c_ptr->m_idx, &dam_max0);