OSDN Git Service

アイテム生成に関わる関数群の変更.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 8 Jun 2003 13:34:15 +0000 (13:34 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 8 Jun 2003 13:34:15 +0000 (13:34 +0000)
* goodやgreatなど個別のフラグを渡していた部分をbitフラグで渡すように
  変更.
* デバッグコマンド "^A o" の中での特別製ロール ("r s") では実際の☆生
  成処理と違い, エゴが生成されても☆として上書きしていて, エゴとして
  のart_flagsや修正が残ったままの普通より強い☆が作れていたので, これ
  を修正する意味でロールモードAM_SPECIALを作成. このモード使用時は,
  apply_magic()内で可能な場合は常に☆★のみが生成される.

14 files changed:
src/birth.c
src/cmd2.c
src/defines.h
src/externs.h
src/generate.c
src/grid.c
src/init1.c
src/object2.c
src/racial.c
src/rooms.c
src/spells1.c
src/store.c
src/wizard2.c
src/xtra2.c

index 20e87c4..1f61609 100644 (file)
@@ -3749,7 +3749,7 @@ void player_outfit(void)
                object_prep(q_ptr, lookup_kind(TV_FLASK, SV_ANY));
 
                /* Fuel with oil (move pval to xtra4) */
-               apply_magic(q_ptr, 1, FALSE, FALSE, FALSE, FALSE);
+               apply_magic(q_ptr, 1, 0L);
 
                q_ptr->number = (byte)rand_range(7, 12);
                object_aware(q_ptr);
index 01b11a8..e8f6abf 100644 (file)
@@ -440,7 +440,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
        int number;
 
        bool small;
-       bool great = FALSE;
+       u32b mode = AM_OKAY | AM_GOOD;
 
        object_type forge;
        object_type *q_ptr;
@@ -458,7 +458,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
        {
                number = 5;
                small = FALSE;
-               great = TRUE;
+               mode |= AM_GREAT;
                object_level = o_ptr->xtra3;
        }
        else
@@ -493,7 +493,7 @@ static void chest_death(bool scatter, int y, int x, s16b o_idx)
                else
                {
                        /* Make a good object */
-                       if (!make_object(q_ptr, TRUE, great)) continue;
+                       if (!make_object(q_ptr, mode)) continue;
                }
 
                /* If chest scatters its contents, pick any floor square. */
@@ -1724,7 +1724,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
                        if (randint0(100) < (15 - dun_level/2))
                        {
                                /* Create a simple object */
-                               place_object(y, x, FALSE, FALSE);
+                               place_object(y, x, AM_OKAY);
 
                                /* Observe new object */
                                if (player_can_see_bold(y, x))
index e3e3b5a..1d8bddf 100644 (file)
         TRC_TELEPORT | TRC_DRAIN_HP | TRC_DRAIN_MANA)
 
 
+
+/*
+ * Bit flags for apply_magic() (etc)
+ */
+#define AM_OKAY    0x00000001 /* Allow roll for fixed artifacts */
+#define AM_GOOD    0x00000002 /* Generate good items */
+#define AM_GREAT   0x00000004 /* Generate great items */
+#define AM_SPECIAL 0x00000008 /* Generate artifacts (for debug mode only) */
+#define AM_CURSED  0x00000010 /* Generate cursed/worthless items */
+
+
 /*** Monster blow constants ***/
 
 
index d17f03d..5310ca1 100644 (file)
@@ -919,9 +919,9 @@ extern s16b lookup_kind(int tval, int sval);
 extern void object_wipe(object_type *o_ptr);
 extern void object_prep(object_type *o_ptr, int k_idx);
 extern void object_copy(object_type *o_ptr, object_type *j_ptr);
-extern void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great, bool curse);
-extern bool make_object(object_type *j_ptr, bool good, bool great);
-extern void place_object(int y, int x, bool good, bool great);
+extern void apply_magic(object_type *o_ptr, int lev, u32b mode);
+extern bool make_object(object_type *j_ptr, u32b mode);
+extern void place_object(int y, int x, u32b mode);
 extern bool make_gold(object_type *j_ptr);
 extern void place_gold(int y, int x);
 extern s16b drop_near(object_type *o_ptr, int chance, int y, int x);
index c1f840a..a0b3b2d 100644 (file)
@@ -282,7 +282,7 @@ msg_print("
 
                        case ALLOC_TYP_OBJECT:
                        {
-                               place_object(y, x, FALSE, FALSE);
+                               place_object(y, x, AM_OKAY);
                                break;
                        }
                }
index efa3106..aa67e18 100644 (file)
@@ -295,7 +295,7 @@ msg_print("
                        /* Place an item */
                        if (randint0(100) < 75)
                        {
-                               place_object(j, k, FALSE, FALSE);
+                               place_object(j, k, AM_OKAY);
                        }
 
                        /* Place gold */
index 9773ff6..e4ed438 100644 (file)
@@ -3339,7 +3339,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                 */
                                if (randint0(100) < 75)
                                {
-                                       place_object(*y, *x, FALSE, FALSE);
+                                       place_object(*y, *x, AM_OKAY);
                                }
                                else
                                {
@@ -3354,11 +3354,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
 
                                /* Create an out of deep object */
                                if (randint0(100) < 75)
-                                       place_object(*y, *x, FALSE, FALSE);
+                                       place_object(*y, *x, AM_OKAY);
                                else if (randint0(100) < 80)
-                                       place_object(*y, *x, TRUE, FALSE);
+                                       place_object(*y, *x, AM_OKAY | AM_GOOD);
                                else
-                                       place_object(*y, *x, TRUE, TRUE);
+                                       place_object(*y, *x, AM_OKAY | AM_GOOD | AM_GREAT);
 
                                object_level = base_level;
                        }
@@ -3389,7 +3389,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                }
 
                                /* Apply magic (no messages, no artifacts) */
-                               apply_magic(o_ptr, base_level, FALSE, TRUE, FALSE, FALSE);
+                               apply_magic(o_ptr, base_level, AM_GOOD);
 
                                (void)drop_near(o_ptr, -1, *y, *x);
                        }
index d6a04cf..7992d0e 100644 (file)
@@ -2352,7 +2352,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(30))
+                               if (one_in_(30) || (power > 2)) /* power > 2 is debug only */
                                        create_artifact(o_ptr, FALSE);
                                else
                                        /* Special Ego-item */
@@ -2384,7 +2384,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        /* Very Good */
                        if (power > 1)
                        {
-                               if (one_in_(40))
+                               if (one_in_(40) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2510,7 +2510,7 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2529,6 +2529,12 @@ static void a_m_aux_1(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
+                               if (power > 2) /* power > 2 is debug only */
+                               {
+                                       create_artifact(o_ptr, FALSE);
+                                       break;
+                               }
+
                                o_ptr->name2 = get_random_ego(INVEN_AMMO, TRUE);
 
                                switch (o_ptr->name2)
@@ -2680,7 +2686,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                {
                        /* Rating boost */
                        rating += 30;
-                       if(one_in_(50))
+                       if (one_in_(50) || (power > 2)) /* power > 2 is debug only */
                                create_artifact(o_ptr, FALSE);
 
                        /* Mention the item */
@@ -2715,7 +2721,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                                        break;
                                }
 
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2776,7 +2782,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2812,7 +2818,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        }
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2844,7 +2850,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2875,7 +2881,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2937,7 +2943,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -2983,7 +2989,7 @@ static void a_m_aux_2(object_type *o_ptr, int level, int power)
                        /* Very good */
                        if (power > 1)
                        {
-                               if (one_in_(20))
+                               if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
                                {
                                        create_artifact(o_ptr, FALSE);
                                        break;
@@ -3324,9 +3330,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        break;
                                }
                        }
-                       if (one_in_(400) && (power > 0) && !cursed_p(o_ptr) && (level > 79))
+                       if ((one_in_(400) && (power > 0) && !cursed_p(o_ptr) && (level > 79))
+                           || (power > 2)) /* power > 2 is debug only */
                        {
-                               o_ptr->pval = MIN(o_ptr->pval,4);
+                               o_ptr->pval = MIN(o_ptr->pval, 4);
                                /* Randart amulet */
                                create_artifact(o_ptr, FALSE);
                        }
@@ -3662,9 +3669,10 @@ static void a_m_aux_3(object_type *o_ptr, int level, int power)
                                        break;
                                }
                        }
-                       if (one_in_(150) && (power > 0) && !cursed_p(o_ptr) && (level > 79))
+                       if ((one_in_(150) && (power > 0) && !cursed_p(o_ptr) && (level > 79))
+                           || (power > 2)) /* power > 2 is debug only */
                        {
-                               o_ptr->pval = MIN(o_ptr->pval,4);
+                               o_ptr->pval = MIN(o_ptr->pval, 4);
                                /* Randart amulet */
                                create_artifact(o_ptr, FALSE);
                        }
@@ -3883,7 +3891,11 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
                                o_ptr->pval = 0;
                        }
 
-                       if ((power == 2) || ((power == 1) && one_in_(3)))
+                       if (power > 2) /* power > 2 is debug only */
+                       {
+                               create_artifact(o_ptr, FALSE);
+                       }
+                       else if ((power == 2) || ((power == 1) && one_in_(3)))
                        {
                                while (!o_ptr->name2)
                                {
@@ -4141,9 +4153,8 @@ static void a_m_aux_4(object_type *o_ptr, int level, int power)
  * "good" and "great" arguments are false.  As a total hack, if "great" is
  * true, then the item gets 3 extra "attempts" to become an artifact.
  */
-void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great, bool curse)
+void apply_magic(object_type *o_ptr, int lev, u32b mode)
 {
-
        int i, rolls, f1, f2, power;
 
        if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += randint0(p_ptr->lev/2+10);
@@ -4179,13 +4190,19 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
        power = 0;
 
        /* Roll for "good" */
-       if (good || magik(f1))
+       if ((mode & AM_GOOD) || magik(f1))
        {
                /* Assume "good" */
                power = 1;
 
                /* Roll for "great" */
-               if (great || magik(f2)) power = 2;
+               if ((mode & AM_GREAT) || magik(f2))
+               {
+                       power = 2;
+
+                       /* Roll for "special" */
+                       if (mode & AM_SPECIAL) power = 3;
+               }
        }
 
        /* Roll for "cursed" */
@@ -4199,7 +4216,7 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
        }
 
        /* Apply curse */
-       if (curse)
+       if (mode & AM_CURSED)
        {
                /* Assume 'cursed' */
                if (power > 0)
@@ -4219,11 +4236,11 @@ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great,
        /* Get one roll if excellent */
        if (power >= 2) rolls = 1;
 
-       /* Hack -- Get four rolls if forced great */
-       if (great) rolls = 4;
+       /* Hack -- Get four rolls if forced great or special */
+       if (mode & (AM_GREAT | AM_SPECIAL)) rolls = 4;
 
        /* Hack -- Get no rolls if not allowed */
-       if (!okay || o_ptr->name1) rolls = 0;
+       if (!(mode & AM_OKAY) || o_ptr->name1) rolls = 0;
 
        /* Roll for artifacts if allowed */
        for (i = 0; i < rolls; i++)
@@ -4587,17 +4604,17 @@ static bool kind_is_good(int k_idx)
  *
  * We assume that the given object has been "wiped".
  */
-bool make_object(object_type *j_ptr, bool good, bool great)
+bool make_object(object_type *j_ptr, u32b mode)
 {
        int prob, base;
        byte obj_level;
 
 
        /* Chance of "special object" */
-       prob = (good ? 10 : 1000);
+       prob = ((mode & AM_GOOD) ? 10 : 1000);
 
        /* Base level for the object */
-       base = (good ? (object_level + 10) : object_level);
+       base = ((mode & AM_GOOD) ? (object_level + 10) : object_level);
 
 
        /* Generate a special object, or a normal object */
@@ -4606,7 +4623,7 @@ bool make_object(object_type *j_ptr, bool good, bool great)
                int k_idx;
 
                /* Good objects */
-               if (good)
+               if (mode & AM_GOOD)
                {
                        /* Activate restriction */
                        get_obj_num_hook = kind_is_good;
@@ -4636,7 +4653,7 @@ bool make_object(object_type *j_ptr, bool good, bool great)
        }
 
        /* Apply magic (allow artifacts) */
-       apply_magic(j_ptr, object_level, TRUE, good, great, FALSE);
+       apply_magic(j_ptr, object_level, mode);
 
        /* Hack -- generate multiple spikes/missiles */
        switch (j_ptr->tval)
@@ -4679,7 +4696,7 @@ bool make_object(object_type *j_ptr, bool good, bool great)
  *
  * This routine requires a clean floor grid destination.
  */
-void place_object(int y, int x, bool good, bool great)
+void place_object(int y, int x, u32b mode)
 {
        s16b o_idx;
 
@@ -4703,7 +4720,7 @@ void place_object(int y, int x, bool good, bool great)
        object_wipe(q_ptr);
 
        /* Make an object (if possible) */
-       if (!make_object(q_ptr, good, great)) return;
+       if (!make_object(q_ptr, mode)) return;
 
 
        /* Make an object */
@@ -5215,6 +5232,7 @@ void acquirement(int y1, int x1, int num, bool great, bool known)
 {
        object_type *i_ptr;
        object_type object_type_body;
+       u32b mode = AM_OKAY | AM_GOOD | (great ? AM_GREAT : 0L);
 
        /* Acquirement */
        while (num--)
@@ -5226,7 +5244,7 @@ void acquirement(int y1, int x1, int num, bool great, bool known)
                object_wipe(i_ptr);
 
                /* Make a good (or great) object (if possible) */
-               if (!make_object(i_ptr, TRUE, great)) continue;
+               if (!make_object(i_ptr, mode)) continue;
 
                if (known)
                {
index b19dfa1..832a767 100644 (file)
@@ -124,7 +124,7 @@ static bool do_cmd_archer(void)
                        q_ptr->number = (byte)rand_range(15,30);
                        object_aware(q_ptr);
                        object_known(q_ptr);
-                       apply_magic(q_ptr, p_ptr->lev, FALSE, FALSE, FALSE, FALSE);
+                       apply_magic(q_ptr, p_ptr->lev, 0L);
                        q_ptr->discount = 99;
 
                        (void)inven_carry(q_ptr);
@@ -188,7 +188,7 @@ static bool do_cmd_archer(void)
                q_ptr->number = (byte)rand_range(5,10);
                object_aware(q_ptr);
                object_known(q_ptr);
-               apply_magic(q_ptr, p_ptr->lev, FALSE, FALSE, FALSE, FALSE);
+               apply_magic(q_ptr, p_ptr->lev, 0L);
 
                q_ptr->discount = 99;
 
@@ -252,7 +252,7 @@ static bool do_cmd_archer(void)
                q_ptr->number = (byte)rand_range(4,8);
                object_aware(q_ptr);
                object_known(q_ptr);
-               apply_magic(q_ptr, p_ptr->lev, FALSE, FALSE, FALSE, FALSE);
+               apply_magic(q_ptr, p_ptr->lev, 0L);
 
                q_ptr->discount = 99;
 
index c0e33db..027954f 100644 (file)
@@ -745,7 +745,7 @@ static void build_type3(int by0, int bx0)
                        }
 
                        /* Place a treasure in the vault */
-                       place_object(yval, xval, FALSE, FALSE);
+                       place_object(yval, xval, AM_OKAY);
 
                        /* Let's guard the treasure well */
                        vault_monsters(yval, xval, randint0(2) + 3);
@@ -961,7 +961,7 @@ static void build_type4(int by0, int bx0)
                        /* Object (80%) */
                        if (randint0(100) < 80)
                        {
-                               place_object(yval, xval, FALSE, FALSE);
+                               place_object(yval, xval, AM_OKAY);
                        }
 
                        /* Stairs (20%) */
@@ -1044,8 +1044,8 @@ static void build_type4(int by0, int bx0)
                                vault_monsters(yval, xval + 2, randint1(2));
 
                                /* Objects */
-                               if (one_in_(3)) place_object(yval, xval - 2, FALSE, FALSE);
-                               if (one_in_(3)) place_object(yval, xval + 2, FALSE, FALSE);
+                               if (one_in_(3)) place_object(yval, xval - 2, AM_OKAY);
+                               if (one_in_(3)) place_object(yval, xval + 2, AM_OKAY);
                        }
 
                        break;
@@ -2515,7 +2515,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                        case '*':
                                if (randint0(100) < 75)
                                {
-                                       place_object(y, x, FALSE, FALSE);
+                                       place_object(y, x, AM_OKAY);
                                }
                                else
                                {
@@ -2571,7 +2571,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                        case 'A':
                                /* Reward for Pattern walk */
                                object_level = base_level + 12;
-                               place_object(y, x, TRUE, FALSE);
+                               place_object(y, x, AM_OKAY | AM_GOOD);
                                object_level = base_level;
                                break;
                        }
@@ -2636,7 +2636,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                                        place_monster(y, x, PM_ALLOW_SLEEP);
                                        monster_level = base_level;
                                        object_level = base_level + 7;
-                                       place_object(y, x, TRUE, FALSE);
+                                       place_object(y, x, AM_OKAY | AM_GOOD);
                                        object_level = base_level;
                                        break;
                                }
@@ -2648,7 +2648,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                                        place_monster(y, x, PM_ALLOW_SLEEP);
                                        monster_level = base_level;
                                        object_level = base_level + 20;
-                                       place_object(y, x, TRUE, TRUE);
+                                       place_object(y, x, AM_OKAY | AM_GOOD | AM_GREAT);
                                        object_level = base_level;
                                        break;
                                }
@@ -2665,7 +2665,7 @@ static void build_vault(int yval, int xval, int ymax, int xmax, cptr data,
                                        if (randint0(100) < 50)
                                        {
                                                object_level = base_level + 7;
-                                               place_object(y, x, FALSE, FALSE);
+                                               place_object(y, x, AM_OKAY);
                                                object_level = base_level;
                                        }
                                        break;
@@ -3892,7 +3892,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
                                        monster_level = base_level;
                                        object_level = base_level + 20;
-                                       place_object(y, x, TRUE, FALSE);
+                                       place_object(y, x, AM_OKAY | AM_GOOD);
                                        object_level = base_level;
                                }
                                else if (value < 5)
@@ -3902,7 +3902,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        place_monster(y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
                                        monster_level = base_level;
                                        object_level = base_level + 10;
-                                       place_object(y, x, TRUE, FALSE);
+                                       place_object(y, x, AM_OKAY | AM_GOOD);
                                        object_level = base_level;
                                }
                                else if (value < 10)
@@ -3928,7 +3928,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        /* Object or trap */
                                        if (randint0(100) < 25)
                                        {
-                                               place_object(y, x, FALSE, FALSE);
+                                               place_object(y, x, AM_OKAY);
                                        }
                                        else
                                        {
@@ -3955,7 +3955,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        if (randint0(100) < 50)
                                        {
                                                object_level = base_level + 7;
-                                               place_object(y, x, FALSE, FALSE);
+                                               place_object(y, x, AM_OKAY);
                                                object_level = base_level;
                                        }
                                }
@@ -3979,7 +3979,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
                                        }
                                        else if (randint0(100) < 50)
                                        {
-                                               place_object(y, x, FALSE, FALSE);
+                                               place_object(y, x, AM_OKAY);
                                        }
                                }
 
@@ -5314,7 +5314,7 @@ static void build_type12(int by0, int bx0)
                build_small_room(x0, y0);
 
                /* Place a treasure in the vault */
-               place_object(y0, x0, FALSE, FALSE);
+               place_object(y0, x0, AM_OKAY);
 
                /* Let's guard the treasure well */
                vault_monsters(y0, x0, randint0(2) + 3);
index f22519f..2a198b1 100644 (file)
@@ -969,7 +969,7 @@ msg_print("
                                        }
 
                                        /* Place gold */
-                                       place_object(y, x, FALSE, FALSE);
+                                       place_object(y, x, AM_OKAY);
                                }
                        }
 
index 9d07894..7b0385c 100644 (file)
@@ -1923,7 +1923,7 @@ static void store_create(void)
                object_prep(q_ptr, i);
 
                /* Apply some "low-level" magic (no artifacts) */
-               apply_magic(q_ptr, level, FALSE, FALSE, FALSE, FALSE);
+               apply_magic(q_ptr, level, 0L);
 
                /* Require valid object */
                if (!store_will_buy(q_ptr)) continue;
index 95ab8bf..f9cc28d 100644 (file)
@@ -917,44 +917,45 @@ static void wiz_reroll_item(object_type *o_ptr)
                        case 'w': case 'W':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, FALSE, TRUE, TRUE, TRUE);
+                               apply_magic(q_ptr, dun_level, AM_GOOD | AM_GREAT | AM_CURSED);
                                break;
                        }
                        /* Apply bad magic, but first clear object */
                        case 'c': case 'C':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, FALSE, TRUE, FALSE, TRUE);
+                               apply_magic(q_ptr, dun_level, AM_GOOD | AM_CURSED);
                                break;
                        }
                        /* Apply normal magic, but first clear object */
                        case 'n': case 'N':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, FALSE, FALSE, FALSE, FALSE);
+                               apply_magic(q_ptr, dun_level, 0L);
                                break;
                        }
                        /* Apply good magic, but first clear object */
                        case 'g': case 'G':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, FALSE, TRUE, FALSE, FALSE);
+                               apply_magic(q_ptr, dun_level, AM_GOOD);
                                break;
                        }
                        /* Apply great magic, but first clear object */
                        case 'e': case 'E':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, FALSE, TRUE, TRUE, FALSE);
+                               apply_magic(q_ptr, dun_level, AM_GOOD | AM_GREAT);
                                break;
                        }
+                       /* Apply special magic, but first clear object */
                        case 's': case 'S':
                        {
                                object_prep(q_ptr, o_ptr->k_idx);
-                               apply_magic(q_ptr, dun_level, TRUE, TRUE, TRUE, FALSE);
+                               apply_magic(q_ptr, dun_level, AM_OKAY | AM_GOOD | AM_GREAT | AM_SPECIAL);
 
-                               /* Failed to create normal artifact; make a random one */
-                               if (!artifact_p(q_ptr)) create_artifact(q_ptr, FALSE);
+                               /* Failed to create artifact; make a random one */
+                               if (!artifact_p(q_ptr) && !q_ptr->art_name) create_artifact(q_ptr, FALSE);
                                break;
                        }
                }
@@ -1002,7 +1003,7 @@ static void wiz_statistics(object_type *o_ptr)
        char ch;
        cptr quality;
 
-       bool good, great;
+       u32b mode;
 
        object_type forge;
        object_type     *q_ptr;
@@ -1030,26 +1031,21 @@ static void wiz_statistics(object_type *o_ptr)
 
                if (ch == 'n' || ch == 'N')
                {
-                       good = FALSE;
-                       great = FALSE;
+                       mode = AM_OKAY;
                        quality = "normal";
                }
                else if (ch == 'g' || ch == 'G')
                {
-                       good = TRUE;
-                       great = FALSE;
+                       mode = AM_OKAY | AM_GOOD;
                        quality = "good";
                }
                else if (ch == 'e' || ch == 'E')
                {
-                       good = TRUE;
-                       great = TRUE;
+                       mode = AM_OKAY | AM_GOOD | AM_GREAT;
                        quality = "excellent";
                }
                else
                {
-                       good = FALSE;
-                       great = FALSE;
                        break;
                }
 
@@ -1097,7 +1093,7 @@ static void wiz_statistics(object_type *o_ptr)
                        object_wipe(q_ptr);
 
                        /* Create an object */
-                       make_object(q_ptr, good, great);
+                       make_object(q_ptr, mode);
 
 
                        /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */
@@ -1420,7 +1416,7 @@ static void wiz_create_item(void)
        object_prep(q_ptr, k_idx);
 
        /* Apply magic */
-       apply_magic(q_ptr, dun_level, FALSE, FALSE, FALSE, FALSE);
+       apply_magic(q_ptr, dun_level, 0L);
 
        /* Drop the object from heaven */
        (void)drop_near(q_ptr, -1, py, px);
index 3d61649..a478cfd 100644 (file)
@@ -606,7 +606,7 @@ msg_print("
                        object_wipe(q_ptr);
 
                        /* Make a great object */
-                       make_object(q_ptr, TRUE, TRUE);
+                       make_object(q_ptr, AM_OKAY | AM_GOOD | AM_GREAT);
 
                        /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
@@ -643,8 +643,7 @@ void monster_death(int m_idx, bool drop_item)
 
        bool visible = (m_ptr->ml || (r_ptr->flags1 & RF1_UNIQUE));
 
-       bool good = (r_ptr->flags1 & RF1_DROP_GOOD) ? TRUE : FALSE;
-       bool great = (r_ptr->flags1 & RF1_DROP_GREAT) ? TRUE : FALSE;
+       u32b mo_mode = AM_OKAY;
 
        bool do_gold = (!(r_ptr->flags1 & RF1_ONLY_ITEM));
        bool do_item = (!(r_ptr->flags1 & RF1_ONLY_GOLD));
@@ -742,7 +741,7 @@ msg_print("
                        /* Prepare to make a prize */
                        object_prep(q_ptr, lookup_kind(arena_info[p_ptr->arena_number].tval, arena_info[p_ptr->arena_number].sval));
 
-                       apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
+                       apply_magic(q_ptr, object_level, 0L);
 
                        /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
@@ -803,7 +802,7 @@ msg_print("
                /* Prepare to make an object */
                object_prep(q_ptr, lookup_kind(TV_CORPSE, (corpse ? SV_CORPSE : SV_SKELETON)));
 
-               apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
+               apply_magic(q_ptr, object_level, 0L);
 
                q_ptr->pval = m_ptr->r_idx;
 
@@ -856,7 +855,7 @@ msg_print("
                        /* Prepare to make a Blade of Chaos */
                        object_prep(q_ptr, lookup_kind(TV_SWORD, SV_BLADE_OF_CHAOS));
 
-                       apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
+                       apply_magic(q_ptr, object_level, 0L);
 
                        /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
@@ -882,7 +881,7 @@ msg_print("
                        get_obj_num_prep();
 
                        /* Make a book */
-                       make_object(q_ptr, FALSE, FALSE);
+                       make_object(q_ptr, AM_OKAY);
 
                        /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
@@ -984,7 +983,7 @@ msg_print("
                q_ptr->name1 = ART_GROND;
 
                /* Mega-Hack -- Actually create "Grond" */
-               apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
+               apply_magic(q_ptr, -1, AM_OKAY | AM_GOOD | AM_GREAT);
 
                /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
@@ -999,7 +998,7 @@ msg_print("
                q_ptr->name1 = ART_CHAOS;
 
                /* Mega-Hack -- Actually create "Chaos" */
-               apply_magic(q_ptr, -1, TRUE, TRUE, TRUE, FALSE);
+               apply_magic(q_ptr, -1, AM_OKAY | AM_GOOD | AM_GREAT);
 
                /* Drop it in the dungeon */
                (void)drop_near(q_ptr, -1, y, x);
@@ -1030,7 +1029,7 @@ msg_print("
                        /* Prepare to make a Can of Toys */
                        object_prep(q_ptr, lookup_kind(TV_CHEST, SV_CHEST_KANDUME));
 
-                       apply_magic(q_ptr, object_level, FALSE, FALSE, FALSE, FALSE);
+                       apply_magic(q_ptr, object_level, 0L);
 
                        /* Drop it in the dungeon */
                        (void)drop_near(q_ptr, -1, y, x);
@@ -1065,7 +1064,7 @@ msg_print("
                                get_obj_num_prep();
 
                                /* Make a cloak */
-                               make_object(q_ptr, FALSE, FALSE);
+                               make_object(q_ptr, AM_OKAY);
 
                                /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
@@ -1088,7 +1087,7 @@ msg_print("
                                get_obj_num_prep();
 
                                /* Make a poleweapon */
-                               make_object(q_ptr, FALSE, FALSE);
+                               make_object(q_ptr, AM_OKAY);
 
                                /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
@@ -1111,7 +1110,7 @@ msg_print("
                                get_obj_num_prep();
 
                                /* Make a hard armor */
-                               make_object(q_ptr, FALSE, FALSE);
+                               make_object(q_ptr, AM_OKAY);
 
                                /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
@@ -1134,7 +1133,7 @@ msg_print("
                                get_obj_num_prep();
 
                                /* Make a sword */
-                               make_object(q_ptr, FALSE, FALSE);
+                               make_object(q_ptr, AM_OKAY);
 
                                /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
@@ -1358,7 +1357,7 @@ msg_print("
                                /* Prepare to make a reward */
                                object_prep(q_ptr, k_idx);
 
-                               apply_magic(q_ptr, object_level, FALSE, TRUE, FALSE, FALSE);
+                               apply_magic(q_ptr, object_level, AM_GOOD);
 
                                /* Drop it in the dungeon */
                                (void)drop_near(q_ptr, -1, y, x);
@@ -1392,6 +1391,9 @@ msg_print("
        /* Average dungeon and monster levels */
        object_level = (dun_level + r_ptr->level) / 2;
 
+       if (r_ptr->flags1 & RF1_DROP_GOOD) mo_mode |= AM_GOOD;
+       if (r_ptr->flags1 & RF1_DROP_GREAT) mo_mode |= AM_GREAT;
+
        /* Drop some objects */
        for (j = 0; j < number; j++)
        {
@@ -1415,7 +1417,7 @@ msg_print("
                else
                {
                        /* Make an object */
-                       if (!make_object(q_ptr, good, great)) continue;
+                       if (!make_object(q_ptr, mo_mode)) continue;
 
                        /* XXX XXX XXX */
                        dump_item++;