OSDN Git Service

[Refactor] #37353 wizard-special-process.c において1行ごとに挟まれていたコメントを削除 / Removed many...
authorHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 09:53:43 +0000 (18:53 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 27 Jun 2020 09:53:43 +0000 (18:53 +0900)
src/wizard/wizard-special-process.c

index e8590de..567c82e 100644 (file)
@@ -1,5 +1,4 @@
 /*!
- * @file wizard2.c
  * @brief ウィザードモードの処理(特別処理中心) / Wizard commands
  * @date 2014/09/07
  * @author
@@ -88,6 +87,8 @@
 #include "wizard/wizard-spoiler.h"
 #include "world/world.h"
 
+#define K_MAX_DEPTH 110 /*!< アイテムの階層毎生成率を表示する最大階 */
+
 #define NUM_O_SET 8
 #define NUM_O_BIT 32
 
@@ -172,19 +173,15 @@ static bool wiz_dimension_door(player_type *caster_ptr)
 static void wiz_create_named_art(player_type *caster_ptr)
 {
        char tmp_val[10] = "";
-       ARTIFACT_IDX a_idx;
-
-       /* Query */
        if (!get_string("Artifact ID:", tmp_val, 3)) return;
 
-       /* Extract */
-       a_idx = (ARTIFACT_IDX)atoi(tmp_val);
+       ARTIFACT_IDX a_idx = (ARTIFACT_IDX)atoi(tmp_val);
        if (a_idx < 0) a_idx = 0;
+
        if (a_idx >= max_a_idx) a_idx = 0;
 
        (void)create_named_art(caster_ptr, a_idx, caster_ptr->y, caster_ptr->x);
 
-       /* All done */
        msg_print("Allocated.");
 }
 
@@ -213,19 +210,13 @@ static void do_cmd_summon_horde(player_type *caster_ptr)
  */
 static void prt_binary(BIT_FLAGS flags, int row, int col)
 {
-       int i;
        u32b bitmask;
-
-       /* Scan the flags */
-       for (i = bitmask = 1; i <= 32; i++, bitmask *= 2)
+       for (int i = bitmask = 1; i <= 32; i++, bitmask *= 2)
        {
-               /* Dump set bits */
                if (flags & bitmask)
                {
                        Term_putch(col++, row, TERM_BLUE, '*');
                }
-
-               /* Dump unset bits */
                else
                {
                        Term_putch(col++, row, TERM_WHITE, '-');
@@ -234,8 +225,6 @@ static void prt_binary(BIT_FLAGS flags, int row, int col)
 }
 
 
-#define K_MAX_DEPTH 110 /*!< アイテムの階層毎生成率を表示する最大階 */
-
 /*!
  * @brief アイテムの階層毎生成率を表示する / Output a rarity graph for a type of object.
  * @param tval ベースアイテムの大項目ID
@@ -253,7 +242,6 @@ static void prt_alloc(tval_type tval, OBJECT_SUBTYPE_VALUE sval, TERM_LEN row, T
        s32b display[22];
        (void)C_WIPE(display, 22, s32b);
 
-       /* Scan all entries */
        int home = 0;
        for (int i = 0; i < K_MAX_DEPTH; i++)
        {
@@ -273,42 +261,33 @@ static void prt_alloc(tval_type tval, OBJECT_SUBTYPE_VALUE sval, TERM_LEN row, T
                                prob = table[j].prob1 * i * K_MAX_DEPTH / (table[j].level - 1);
                        }
 
-                       /* Acquire this kind */
                        k_ptr = &k_info[table[j].index];
 
-                       /* Accumulate probabilities */
                        total[i] += prob / (GREAT_OBJ * K_MAX_DEPTH);
                        total_frac += prob % (GREAT_OBJ * K_MAX_DEPTH);
 
-                       /* Accumulate probabilities */
                        if ((k_ptr->tval == tval) && (k_ptr->sval == sval))
                        {
                                home = k_ptr->level;
                                rarity[i] += prob / (GREAT_OBJ * K_MAX_DEPTH);
                        }
                }
+
                total[i] += total_frac / (GREAT_OBJ * K_MAX_DEPTH);
        }
 
-       /* Calculate probabilities for each range */
        for (int i = 0; i < 22; i++)
        {
-               /* Shift the values into view */
                int possibility = 0;
                for (int j = i * K_MAX_DEPTH / 22; j < (i + 1) * K_MAX_DEPTH / 22; j++)
                        possibility += rarity[j] * 100000 / total[j];
                display[i] = possibility / 5;
        }
 
-       /* Graph the rarities */
        for (int i = 0; i < 22; i++)
        {
                Term_putch(col, row + i + 1, TERM_WHITE, '|');
-
                prt(format("%2dF", (i * 5)), row + i + 1, col);
-
-
-               /* Note the level */
                if ((i * K_MAX_DEPTH / 22 <= home) && (home < (i + 1) * K_MAX_DEPTH / 22))
                {
                        c_prt(TERM_RED, format("%3d.%04d%%", display[i] / 1000, display[i] % 1000), row + i + 1, col + 3);
@@ -319,7 +298,6 @@ static void prt_alloc(tval_type tval, OBJECT_SUBTYPE_VALUE sval, TERM_LEN row, T
                }
        }
 
-       /* Make it look nice */
        concptr r = "+---Rate---+";
        prt(r, row, col);
 }
@@ -331,32 +309,20 @@ static void prt_alloc(tval_type tval, OBJECT_SUBTYPE_VALUE sval, TERM_LEN row, T
  */
 static void do_cmd_wiz_reset_class(player_type *creature_ptr)
 {
-       /* Prompt */
        char ppp[80];
        sprintf(ppp, "Class (0-%d): ", MAX_CLASS - 1);
 
-       /* Default */
        char tmp_val[160];
        sprintf(tmp_val, "%d", creature_ptr->pclass);
 
-       /* Query */
        if (!get_string(ppp, tmp_val, 2)) return;
 
-       /* Extract */
        int tmp_int = atoi(tmp_val);
-
-       /* Verify */
        if (tmp_int < 0 || tmp_int >= MAX_CLASS) return;
 
-       /* Save it */
        creature_ptr->pclass = (byte)tmp_int;
-
-       /* Redraw inscription */
        creature_ptr->window |= (PW_PLAYER);
-
-       /* {.} and {$} effect creature_ptr->warning and TRC_TELEPORT_SELF */
        creature_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
-
        handle_stuff(creature_ptr);
 }
 
@@ -367,10 +333,8 @@ static void do_cmd_wiz_reset_class(player_type *creature_ptr)
  */
 static void do_cmd_wiz_bamf(player_type *caster_ptr)
 {
-       /* Must have a target */
        if (!target_who) return;
 
-       /* Teleport to the target */
        teleport_player_to(caster_ptr, target_row, target_col, TELEPORT_NONMAGICAL);
 }
 
@@ -388,40 +352,23 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
        char tmp_val[160];
        char ppp[80];
 
-       /* Query the stats */
        for (int i = 0; i < A_MAX; i++)
        {
-               /* Prompt */
                sprintf(ppp, "%s (3-%d): ", stat_names[i], creature_ptr->stat_max_max[i]);
-
-               /* Default */
                sprintf(tmp_val, "%d", creature_ptr->stat_max[i]);
-
-               /* Query */
                if (!get_string(ppp, tmp_val, 3)) return;
 
-               /* Extract */
                tmp_int = atoi(tmp_val);
-
-               /* Verify */
                if (tmp_int > creature_ptr->stat_max_max[i]) tmp_int = creature_ptr->stat_max_max[i];
                else if (tmp_int < 3) tmp_int = 3;
 
-               /* Save it */
                creature_ptr->stat_cur[i] = creature_ptr->stat_max[i] = (BASE_STATUS)tmp_int;
        }
 
-
-       /* Default */
        sprintf(tmp_val, "%d", WEAPON_EXP_MASTER);
-
-       /* Query */
        if (!get_string(_("熟練度: ", "Proficiency: "), tmp_val, 9)) return;
 
-       /* Extract */
        tmp_s16b = (s16b)atoi(tmp_val);
-
-       /* Verify */
        if (tmp_s16b < WEAPON_EXP_UNSKILLED) tmp_s16b = WEAPON_EXP_UNSKILLED;
        if (tmp_s16b > WEAPON_EXP_MASTER) tmp_s16b = WEAPON_EXP_MASTER;
 
@@ -443,43 +390,27 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
        int k;
        for (k = 0; k < 32; k++)
                creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_MASTER ? SPELL_EXP_MASTER : tmp_s16b);
+
        for (; k < 64; k++)
                creature_ptr->spell_exp[k] = (tmp_s16b > SPELL_EXP_EXPERT ? SPELL_EXP_EXPERT : tmp_s16b);
 
-       /* Default */
        sprintf(tmp_val, "%ld", (long)(creature_ptr->au));
-
-       /* Query */
        if (!get_string("Gold: ", tmp_val, 9)) return;
 
-       /* Extract */
        tmp_long = atol(tmp_val);
-
-       /* Verify */
        if (tmp_long < 0) tmp_long = 0L;
 
-       /* Save */
        creature_ptr->au = tmp_long;
-
-       /* Default */
        sprintf(tmp_val, "%ld", (long)(creature_ptr->max_exp));
-
-       /* Query */
        if (!get_string("Experience: ", tmp_val, 9)) return;
 
-       /* Extract */
        tmp_long = atol(tmp_val);
-
-       /* Verify */
        if (tmp_long < 0) tmp_long = 0L;
 
        if (creature_ptr->prace == RACE_ANDROID) return;
 
-       /* Save */
        creature_ptr->max_exp = tmp_long;
        creature_ptr->exp = tmp_long;
-
-       /* Update */
        check_experience(creature_ptr);
 }
 
@@ -491,7 +422,6 @@ static void do_cmd_wiz_change_aux(player_type *creature_ptr)
  */
 static void do_cmd_wiz_change(player_type *creature_ptr)
 {
-       /* Interact */
        do_cmd_wiz_change_aux(creature_ptr);
        do_cmd_redraw(creature_ptr);
 }
@@ -503,76 +433,16 @@ static void do_cmd_wiz_change(player_type *creature_ptr)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @param o_ptr 詳細を表示するアイテム情報の参照ポインタ
  * @return なし
- * @details
- * Wizard routines for creating objects                -RAK-
- * And for manipulating them!                   -Bernd-
- *
- * This has been rewritten to make the whole procedure
- * of debugging objects much easier and more comfortable.
- *
- * The following functions are meant to play with objects:
- * Create, modify, roll for them (for statistic purposes) and more.
- * The original functions were by RAK.
- * The function to show an item's debug information was written
- * by David Reeve Sward <sward+@CMU.EDU>.
- *                             Bernd (wiebelt@mathematik.hu-berlin.de)
- *
- * Here are the low-level functions
- * - wiz_display_item()
- *     display an item's debug-info
- * - wiz_create_itemtype()
- *     specify tval and sval (type and subtype of object)
- * - wiz_tweak_item()
- *     specify pval, +AC, +tohit, +todam
- *     Note that the wizard can leave this function anytime,
- *     thus accepting the default-values for the remaining values.
- *     pval comes first now, since it is most important.
- * - wiz_reroll_item()
- *     apply some magic to the item or turn it into an artifact.
- * - wiz_roll_item()
- *     Get some statistics about the rarity of an item:
- *     We create a lot of fake items and see if they are of the
- *     same type (tval and sval), then we compare pval and +AC.
- *     If the fake-item is better or equal it is counted.
- *     Note that cursed items that are better or equal (absolute values)
- *     are counted, too.
- *     HINT: This is *very* useful for balancing the game!
- * - wiz_quantity_item()
- *     change the quantity of an item, but be sane about it.
- *
- * And now the high-level functions
- * - do_cmd_wiz_play()
- *     play with an existing object
- * - wiz_create_item()
- *     create a new object
- *
- * Note -- You do not have to specify "pval" and other item-properties
- * directly. Just apply magic until you are satisfied with the item.
- *
- * Note -- For some items (such as wands, staffs, some rings, etc), you
- * must apply magic, or you will get "broken" or "uncharged" objects.
- *
- * Note -- Redefining artifacts via "do_cmd_wiz_play()" may destroy
- * the artifact.  Be careful.
- *
- * Hack -- this function will allow you to create multiple artifacts.
- * This "feature" may induce crashes or other nasty effects.
- * Just display an item's properties (debug-info)
- * Originally by David Reeve Sward <sward+@CMU.EDU>
- * Verbose item flags by -Bernd-
  */
 static void wiz_display_item(player_type *player_ptr, object_type *o_ptr)
 {
        BIT_FLAGS flgs[TR_FLAG_SIZE];
        object_flags(o_ptr, flgs);
 
-       /* Clear the screen */
        int j = 13;
        for (int i = 1; i <= 23; i++) prt("", i, j - 2);
 
        prt_alloc(o_ptr->tval, o_ptr->sval, 1, 0);
-
-       /* Describe fully */
        char buf[256];
        object_desc(player_ptr, buf, o_ptr, OD_STORE);
 
@@ -727,20 +597,13 @@ static const char listsym[] =
 static KIND_OBJECT_IDX wiz_create_itemtype(void)
 {
        KIND_OBJECT_IDX i;
-       int num, max_num;
+       int num;
        TERM_LEN col, row;
-       tval_type tval;
-
-       concptr tval_desc;
        char ch;
-
        KIND_OBJECT_IDX choice[80];
-
        char buf[160];
 
        Term_clear();
-
-       /* Print all tval's and their descriptions */
        for (num = 0; (num < 80) && tvals[num].tval; num++)
        {
                row = 2 + (num % 20);
@@ -749,69 +612,42 @@ static KIND_OBJECT_IDX wiz_create_itemtype(void)
                prt(format("[%c] %s", ch, tvals[num].desc), row, col);
        }
 
-       /* Me need to know the maximal possible tval_index */
-       max_num = num;
-
-       /* Choose! */
+       int max_num = num;
        if (!get_com("Get what type of object? ", &ch, FALSE)) return 0;
 
-       /* Analyze choice */
        for (num = 0; num < max_num; num++)
        {
                if (listsym[num] == ch) break;
        }
 
-       /* Bail out if choice is illegal */
        if ((num < 0) || (num >= max_num)) return 0;
 
-       /* Base object type chosen, fill in tval */
-       tval = tvals[num].tval;
-       tval_desc = tvals[num].desc;
-
-       /*** And now we go for k_idx ***/
+       tval_type tval = tvals[num].tval;
+       concptr tval_desc = tvals[num].desc;
        Term_clear();
-
-       /* We have to search the whole itemlist. */
        for (num = 0, i = 1; (num < 80) && (i < max_k_idx); i++)
        {
                object_kind *k_ptr = &k_info[i];
-
-               /* Analyze matching items */
                if (k_ptr->tval != tval) continue;
 
-               /* Prepare it */
                row = 2 + (num % 20);
                col = 20 * (num / 20);
                ch = listsym[num];
                strcpy(buf, "                    ");
-
-               /* Acquire the "name" of object "i" */
                strip_name(buf, i);
-
-               /* Print it */
                prt(format("[%c] %s", ch, buf), row, col);
-
-               /* Remember the object index */
                choice[num++] = i;
        }
 
-       /* Me need to know the maximal possible remembered object_index */
        max_num = num;
-
-       /* Choose! */
        if (!get_com(format("What Kind of %s? ", tval_desc), &ch, FALSE)) return 0;
 
-       /* Analyze choice */
        for (num = 0; num < max_num; num++)
-       {
                if (listsym[num] == ch) break;
-       }
 
-       /* Bail out if choice is "illegal" */
        if ((num < 0) || (num >= max_num)) return 0;
 
-       /* And return successful */
-       return (choice[num]);
+       return choice[num];
 }
 
 
@@ -867,18 +703,13 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
        q_ptr = &forge;
        object_copy(q_ptr, o_ptr);
 
-       /* Main loop. Ask for magification and artifactification */
        char ch;
        bool changed = FALSE;
        while (TRUE)
        {
-               /* Display full item debug information */
                wiz_display_item(owner_ptr, q_ptr);
-
-               /* Ask wizard what to do. */
                if (!get_com("[a]ccept, [w]orthless, [c]ursed, [n]ormal, [g]ood, [e]xcellent, [s]pecial? ", &ch, FALSE))
                {
-                       /* Preserve wizard-generated artifacts */
                        if (object_is_fixed_artifact(q_ptr))
                        {
                                a_info[q_ptr->name1].cur_num = 0;
@@ -889,14 +720,12 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
                        break;
                }
 
-               /* Create/change it! */
                if (ch == 'A' || ch == 'a')
                {
                        changed = TRUE;
                        break;
                }
 
-               /* Preserve wizard-generated artifacts */
                if (object_is_fixed_artifact(q_ptr))
                {
                        a_info[q_ptr->name1].cur_num = 0;
@@ -905,7 +734,7 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
 
                switch (ch)
                {
-                       /* Apply bad magic, but first clear object */
+               /* Apply bad magic, but first clear object */
                case 'w': case 'W':
                {
                        object_prep(q_ptr, o_ptr->k_idx);
@@ -946,8 +775,8 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
                        object_prep(q_ptr, o_ptr->k_idx);
                        apply_magic(owner_ptr, q_ptr, owner_ptr->current_floor_ptr->dun_level, AM_GOOD | AM_GREAT | AM_SPECIAL);
 
-                       /* Failed to create artifact; make a random one */
                        if (!object_is_artifact(q_ptr)) become_random_artifact(owner_ptr, q_ptr, FALSE);
+
                        break;
                }
                }
@@ -958,7 +787,6 @@ static void wiz_reroll_item(player_type *owner_ptr, object_type *o_ptr)
                q_ptr->marked = o_ptr->marked;
        }
 
-       /* Notice change */
        if (changed)
        {
                object_copy(o_ptr, q_ptr);
@@ -990,10 +818,8 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
        concptr p = "Enter number of items to roll: ";
        char tmp_val[80];
 
-       /* Mega-Hack -- allow multiple artifacts */
        if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 0;
 
-       /* Interact */
        u32b i, matches, better, worse, other, correct;
        u32b test_roll = 1000000;
        char ch;
@@ -1002,11 +828,7 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
        while (TRUE)
        {
                concptr pmt = "Roll for [n]ormal, [g]ood, or [e]xcellent treasure? ";
-
-               /* Display item */
                wiz_display_item(caster_ptr, o_ptr);
-
-               /* Get choices */
                if (!get_com(pmt, &ch, FALSE)) break;
 
                if (ch == 'n' || ch == 'N')
@@ -1032,54 +854,34 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                sprintf(tmp_val, "%ld", (long int)test_roll);
                if (get_string(p, tmp_val, 10)) test_roll = atol(tmp_val);
                test_roll = MAX(1, test_roll);
-
-               /* Let us know what we are doing */
                msg_format("Creating a lot of %s items. Base level = %d.",
                        quality, caster_ptr->current_floor_ptr->dun_level);
                msg_print(NULL);
 
-               /* Set counters to zero */
                correct = matches = better = worse = other = 0;
-
-               /* Let's rock and roll */
                for (i = 0; i <= test_roll; i++)
                {
-                       /* Output every few rolls */
                        if ((i < 100) || (i % 100 == 0))
                        {
-                               /* Do not wait */
                                inkey_scan = TRUE;
-
-                               /* Allow interupt */
                                if (inkey())
                                {
                                        flush();
                                        break; // stop rolling
                                }
 
-                               /* Dump the stats */
                                prt(format(q, i, correct, matches, better, worse, other), 0, 0);
                                Term_fresh();
                        }
+
                        q_ptr = &forge;
                        object_wipe(q_ptr);
-
-                       /* Create an object */
                        make_object(caster_ptr, q_ptr, mode);
-
-
-                       /* Mega-Hack -- allow multiple artifacts */
                        if (object_is_fixed_artifact(q_ptr)) a_info[q_ptr->name1].cur_num = 0;
 
+                       if ((o_ptr->tval != q_ptr->tval) || (o_ptr->sval != q_ptr->sval)) continue;
 
-                       /* Test for the same tval and sval. */
-                       if ((o_ptr->tval) != (q_ptr->tval)) continue;
-                       if ((o_ptr->sval) != (q_ptr->sval)) continue;
-
-                       /* One more correct item */
                        correct++;
-
-                       /* Check for match */
                        if ((q_ptr->pval == o_ptr->pval) &&
                                (q_ptr->to_a == o_ptr->to_a) &&
                                (q_ptr->to_h == o_ptr->to_h) &&
@@ -1088,8 +890,6 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                        {
                                matches++;
                        }
-
-                       /* Check for better */
                        else if ((q_ptr->pval >= o_ptr->pval) &&
                                (q_ptr->to_a >= o_ptr->to_a) &&
                                (q_ptr->to_h >= o_ptr->to_h) &&
@@ -1097,8 +897,6 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                        {
                                better++;
                        }
-
-                       /* Check for worse */
                        else if ((q_ptr->pval <= o_ptr->pval) &&
                                (q_ptr->to_a <= o_ptr->to_a) &&
                                (q_ptr->to_h <= o_ptr->to_h) &&
@@ -1106,20 +904,16 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
                        {
                                worse++;
                        }
-
-                       /* Assume different */
                        else
                        {
                                other++;
                        }
                }
 
-               /* Final dump */
                msg_format(q, i, correct, matches, better, worse, other);
                msg_print(NULL);
        }
 
-       /* Hack -- Normally only make a single artifact */
        if (object_is_fixed_artifact(o_ptr)) a_info[o_ptr->name1].cur_num = 1;
 }
 
@@ -1133,32 +927,23 @@ static void wiz_statistics(player_type *caster_ptr, object_type *o_ptr)
  */
 static void wiz_quantity_item(object_type *o_ptr)
 {
-       /* Never duplicate artifacts */
        if (object_is_artifact(o_ptr)) return;
 
-       /* Store old quantity. -LM- */
        int tmp_qnt = o_ptr->number;
-
-       /* Default */
        char tmp_val[100];
        sprintf(tmp_val, "%d", (int)o_ptr->number);
-
-       /* Query */
        if (get_string("Quantity: ", tmp_val, 2))
        {
-               /* Extract */
                int tmp_int = atoi(tmp_val);
                if (tmp_int < 1) tmp_int = 1;
+
                if (tmp_int > 99) tmp_int = 99;
 
-               /* Accept modifications */
                o_ptr->number = (byte)tmp_int;
        }
 
        if (o_ptr->tval == TV_ROD)
-       {
                o_ptr->pval = o_ptr->pval * o_ptr->number / tmp_qnt;
-       }
 }
 
 
@@ -1211,7 +996,6 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
        OBJECT_IDX item;
        object_type *o_ptr;
        o_ptr = choose_object(creature_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
-
        if (!o_ptr) return;
 
        screen_save(creature_ptr);
@@ -1220,16 +1004,11 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
        object_type *q_ptr;
        q_ptr = &forge;
        object_copy(q_ptr, o_ptr);
-
-       /* The main loop */
        char ch;
        bool changed = FALSE;
        while (TRUE)
        {
-               /* Display the item */
                wiz_display_item(creature_ptr, q_ptr);
-
-               /* Get choice */
                if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch, FALSE))
                {
                        changed = FALSE;
@@ -1264,29 +1043,20 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
        }
 
        screen_load(creature_ptr);
-
-       /* Accept change */
        if (changed)
        {
                msg_print("Changes accepted.");
-
-               /* Recalcurate object's weight */
                if (item >= 0)
                {
                        creature_ptr->total_weight += (q_ptr->weight * q_ptr->number)
                                - (o_ptr->weight * o_ptr->number);
                }
 
-               /* Change */
                object_copy(o_ptr, q_ptr);
-
                creature_ptr->update |= (PU_BONUS);
                creature_ptr->update |= (PU_COMBINE | PU_REORDER);
-
                creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
        }
-
-       /* Ignore change */
        else
        {
                msg_print("Changes ignored.");
@@ -1309,34 +1079,18 @@ static void do_cmd_wiz_play(player_type *creature_ptr)
 static void wiz_create_item(player_type *caster_ptr)
 {
        screen_save(caster_ptr);
-
-       /* Get object base type */
        OBJECT_IDX k_idx = wiz_create_itemtype();
-
        screen_load(caster_ptr);
-
-       /* Return if failed */
        if (!k_idx) return;
 
        if (k_info[k_idx].gen_flags & TRG_INSTA_ART)
        {
-               ARTIFACT_IDX i;
-
-               /* Artifactify */
-               for (i = 1; i < max_a_idx; i++)
+               for (ARTIFACT_IDX i = 1; i < max_a_idx; i++)
                {
-                       /* Ignore incorrect tval */
-                       if (a_info[i].tval != k_info[k_idx].tval) continue;
+                       if ((a_info[i].tval != k_info[k_idx].tval) || (a_info[i].sval != k_info[k_idx].sval)) continue;
 
-                       /* Ignore incorrect sval */
-                       if (a_info[i].sval != k_info[k_idx].sval) continue;
-
-                       /* Create this artifact */
                        (void)create_named_art(caster_ptr, i, caster_ptr->y, caster_ptr->x);
-
-                       /* All done */
                        msg_print("Allocated(INSTA_ART).");
-
                        return;
                }
        }
@@ -1345,13 +1099,8 @@ static void wiz_create_item(player_type *caster_ptr)
        object_type *q_ptr;
        q_ptr = &forge;
        object_prep(q_ptr, k_idx);
-
        apply_magic(caster_ptr, q_ptr, caster_ptr->current_floor_ptr->dun_level, AM_NO_FIXED_ART);
-
-       /* Drop the object from heaven */
        (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
-
-       /* All done */
        msg_print("Allocated.");
 }
 
@@ -1376,72 +1125,47 @@ static void do_cmd_wiz_cure_all(player_type *creature_ptr)
  */
 static void do_cmd_wiz_jump(player_type *creature_ptr)
 {
-       /* Ask for level */
        if (command_arg <= 0)
        {
                char    ppp[80];
                char    tmp_val[160];
                DUNGEON_IDX tmp_dungeon_type;
-
-               /* Prompt */
                sprintf(ppp, "Jump which dungeon : ");
-
-               /* Default */
                sprintf(tmp_val, "%d", creature_ptr->dungeon_idx);
-
-               /* Ask for a level */
                if (!get_string(ppp, tmp_val, 2)) return;
 
                tmp_dungeon_type = (DUNGEON_IDX)atoi(tmp_val);
                if (!d_info[tmp_dungeon_type].maxdepth || (tmp_dungeon_type > current_world_ptr->max_d_idx)) tmp_dungeon_type = DUNGEON_ANGBAND;
 
-               /* Prompt */
                sprintf(ppp, "Jump to level (0, %d-%d): ",
                        (int)d_info[tmp_dungeon_type].mindepth, (int)d_info[tmp_dungeon_type].maxdepth);
 
-               /* Default */
                sprintf(tmp_val, "%d", (int)creature_ptr->current_floor_ptr->dun_level);
-
-               /* Ask for a level */
                if (!get_string(ppp, tmp_val, 10)) return;
 
-               /* Extract request */
                command_arg = (COMMAND_ARG)atoi(tmp_val);
-
                creature_ptr->dungeon_idx = tmp_dungeon_type;
        }
 
        if (command_arg < d_info[creature_ptr->dungeon_idx].mindepth) command_arg = 0;
+
        if (command_arg > d_info[creature_ptr->dungeon_idx].maxdepth) command_arg = (COMMAND_ARG)d_info[creature_ptr->dungeon_idx].maxdepth;
 
-       /* Accept request */
        msg_format("You jump to dungeon level %d.", command_arg);
-
        if (autosave_l) do_cmd_save_game(creature_ptr, TRUE);
 
-       /* Change level */
        creature_ptr->current_floor_ptr->dun_level = command_arg;
-
        prepare_change_floor_mode(creature_ptr, CFM_RAND_PLACE);
-
        if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = 0;
+
        creature_ptr->current_floor_ptr->inside_arena = FALSE;
        creature_ptr->wild_mode = FALSE;
-
        leave_quest_check(creature_ptr);
-
        if (record_stair) exe_write_diary(creature_ptr, DIARY_WIZ_TELE, 0, NULL);
 
        creature_ptr->current_floor_ptr->inside_quest = 0;
        free_turn(creature_ptr);
-
-       /* Prevent energy_need from being too lower than 0 */
        creature_ptr->energy_need = 0;
-
-       /*
-        * Clear all saved floors
-        * and create a first saved floor
-        */
        prepare_change_floor_mode(creature_ptr, CFM_FIRST_FLOOR);
        creature_ptr->leaving = TRUE;
 }
@@ -1455,14 +1179,11 @@ static void do_cmd_wiz_jump(player_type *creature_ptr)
  */
 static void do_cmd_wiz_learn(player_type *caster_ptr)
 {
-       /* Scan every object */
        object_type forge;
        object_type *q_ptr;
        for (KIND_OBJECT_IDX i = 1; i < max_k_idx; i++)
        {
                object_kind *k_ptr = &k_info[i];
-
-               /* Induce awareness */
                if (k_ptr->level <= command_arg)
                {
                        q_ptr = &forge;
@@ -1524,17 +1245,10 @@ static void do_cmd_wiz_named_friendly(player_type *summoner_ptr, MONRACE_IDX r_i
  */
 static void do_cmd_wiz_zap(player_type *caster_ptr)
 {
-       /* Genocide everyone nearby */
        for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               if (!monster_is_valid(m_ptr)) continue;
-
-               /* Skip the mount */
-               if (i == caster_ptr->riding) continue;
-
-               /* Delete nearby monsters */
-               if (m_ptr->cdis > MAX_SIGHT) continue;
+               if (!monster_is_valid(m_ptr) || (i == caster_ptr->riding) || (m_ptr->cdis > MAX_SIGHT)) continue;
 
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                {
@@ -1557,24 +1271,18 @@ static void do_cmd_wiz_zap(player_type *caster_ptr)
  */
 static void do_cmd_wiz_zap_all(player_type *caster_ptr)
 {
-       /* Genocide everyone */
        for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               if (!monster_is_valid(m_ptr)) continue;
-
-               /* Skip the mount */
-               if (i == caster_ptr->riding) continue;
+               if (!monster_is_valid(m_ptr) || (i == caster_ptr->riding)) continue;
 
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                {
                        GAME_TEXT m_name[MAX_NLEN];
-
                        monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
                        exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_WIZ_ZAP, m_name);
                }
 
-               /* Delete this monster */
                delete_monster_idx(caster_ptr, i);
        }
 }
@@ -1593,35 +1301,27 @@ static void do_cmd_wiz_create_feature(player_type *creature_ptr)
 
        grid_type *g_ptr;
        g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
-
-       /* Default */
        static int prev_feat = 0;
        char tmp_val[160];
        sprintf(tmp_val, "%d", prev_feat);
 
-       /* Query */
        if (!get_string(_("地形: ", "Feature: "), tmp_val, 3)) return;
 
-       /* Extract */
        FEAT_IDX tmp_feat = (FEAT_IDX)atoi(tmp_val);
        if (tmp_feat < 0) tmp_feat = 0;
        else if (tmp_feat >= max_f_idx) tmp_feat = max_f_idx - 1;
 
-       /* Default */
        static int prev_mimic = 0;
        sprintf(tmp_val, "%d", prev_mimic);
 
-       /* Query */
        if (!get_string(_("地形 (mimic): ", "Feature (mimic): "), tmp_val, 3)) return;
 
-       /* Extract */
        FEAT_IDX tmp_mimic = (FEAT_IDX)atoi(tmp_val);
        if (tmp_mimic < 0) tmp_mimic = 0;
        else if (tmp_mimic >= max_f_idx) tmp_mimic = max_f_idx - 1;
 
        cave_set_feat(creature_ptr, y, x, tmp_feat);
        g_ptr->mimic = (s16b)tmp_mimic;
-
        feature_type *f_ptr;
        f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
@@ -1634,7 +1334,6 @@ static void do_cmd_wiz_create_feature(player_type *creature_ptr)
        note_spot(creature_ptr, y, x);
        lite_spot(creature_ptr, y, x);
        creature_ptr->update |= (PU_FLOW);
-
        prev_feat = tmp_feat;
        prev_mimic = tmp_mimic;
 }
@@ -1650,24 +1349,20 @@ static void do_cmd_dump_options()
 {
        char buf[1024];
        path_build(buf, sizeof buf, ANGBAND_DIR_USER, "opt_info.txt");
-
        FILE *fff;
        fff = angband_fopen(buf, "a");
-
-       if (!fff)
+       if (fff == NULL)
        {
                msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf);
                msg_print(NULL);
                return;
        }
 
-       /* Allocate the "exist" array (2-dimension) */
        int  **exist;
        C_MAKE(exist, NUM_O_SET, int *);
        C_MAKE(*exist, NUM_O_BIT * NUM_O_SET, int);
        for (int i = 1; i < NUM_O_SET; i++) exist[i] = *exist + i * NUM_O_BIT;
 
-       /* Check for exist option bits */
        for (int i = 0; option_info[i].o_desc; i++)
        {
                const option_type *ot_ptr = &option_info[i];
@@ -1676,11 +1371,9 @@ static void do_cmd_dump_options()
 
        fprintf(fff, "[Option bits usage on Hengband %d.%d.%d]\n\n",
                FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH);
-
        fputs("Set - Bit (Page) Option Name\n", fff);
        fputs("------------------------------------------------\n", fff);
 
-       /* Dump option bits usage */
        for (int i = 0; i < NUM_O_SET; i++)
        {
                for (int j = 0; j < NUM_O_BIT; j++)
@@ -1700,11 +1393,9 @@ static void do_cmd_dump_options()
                fputc('\n', fff);
        }
 
-       /* Free the "exist" array (2-dimension) */
        C_KILL(*exist, NUM_O_BIT * NUM_O_SET, int);
        C_KILL(exist, NUM_O_SET, int *);
        angband_fclose(fff);
-
        msg_format(_("オプションbit使用状況をファイル %s に書き出しました。", "Option bits usage dump saved to file %s."), buf);
 }
 
@@ -1715,12 +1406,68 @@ static void do_cmd_dump_options()
  * The "command_arg" may have been set.
  * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし
+ * @details
+ * 番号を指定するには、それをN及びデバッグコマンドをXとしてとして「0N^aX」とする
+ * a:全状態回復 / Cure all maladies
+ * A:善悪の属性表示 / Know alignment
+ * b:相手をテレポバック / Teleport to target
+ * B:モンスター闘技場のモンスターを更新する / Update gambling monster
+ * c:アイテム生成 / Create any object
+ * C:指定番号の固定アーティファクトを生成する / Create a named artifact
+ * d:全感知 / Detect everything
+ * D:次元の扉 / Dimension_door
+ * e:能力変更 / Edit character
+ * E:全てのスペルをラーニング状態にする / Blue Mage Only
+ * f:*鑑定* / Fully identification
+ * F:地形ID変更 / Create desired feature
+ * g:上質なアイテムを生成 / Good Objects
+ * G:なし / Nothing
+ * h:新生 / Hitpoint rerating
+ * H:モンスターの群れ生成 / Generate monster group
+ * i:鑑定 / Identification
+ * I:なし / Nothing
+ * j:ダンジョンの指定フロアへテレポート (ウィザードあり) / Jump to dungeon
+ * J:なし / Nothing
+ * k:自己分析 / Self info
+ * K:なし / Nothing
+ * l:番号指定したアイテムまで鑑定済にする / Learn about objects
+ * L:なし / Nothing
+ * m:魔法の地図 / Magic Mapping
+ * M:突然変異 / Mutation / TODO: 指定した突然変異の除外機能を追加したい
+ * n:番号指定したモンスターを生成 / Generate a monster
+ * N:番号指定したペットを生成 / Generate a pet
+ * o:アイテムのtval等を編集する / Edit object
+ * O:現在のオプション設定をダンプ出力 / Output option settings
+ * p:ショートテレポ / Blink
+ * P:なし / Nothing
+ * q:クエストを完了させる / Finish quest
+ * Q:クエストに突入する (ウィザードあり) / Jump to quest
+ * r:カオスパトロンから報酬を貰う / Gain reward from chaos patron
+ * R:クラス変更 / Change class
+ * s:フロア相応のモンスター召喚 / Summon a monster
+ * S:高級品獲得ドロップ / Get a great item
+ * t:テレポート / Teleport
+ * T:プレイ日時変更 / Change time
+ * u:啓蒙 (強制的に忍者以外) / Lite floor without ninja classified
+ * U:なし / Nothing
+ * v:特別品獲得ドロップ / Get a special item
+ * V:クラス変更 / Change class / TODO: Rと同じなので何か変えたい
+ * w:啓蒙 (忍者かどうか考慮) / Lite floor with ninja classified
+ * W:なし / Nothing
+ * x:経験値を得る / Gain experience
+ * X:アイテムを初期状態に戻す / Return items to the initial ones
+ * y:なし / Nothing
+ * Y:なし / Nothing
+ * z:近隣のモンスター消去 / Zap monsters around
+ * Z:フロア中のモンスター消去 / Zap all monsters in the floor
+ * @:特殊スペルの発動 / Special spell
+ * ":スポイラーのダンプ / Dump spoiler
+ * ?:ヘルプ表示 (通常の?と同じ) / Show help (same as normal help)
  */
 void do_cmd_debug(player_type *creature_ptr)
 {
        char cmd;
        get_com("Debug Command: ", &cmd, FALSE);
-
        switch (cmd)
        {
        case ESCAPE:
@@ -1728,160 +1475,96 @@ void do_cmd_debug(player_type *creature_ptr)
        case '\n':
        case '\r':
                break;
-
-               /* Hack -- Generate Spoilers */
-       case '"':
-               do_cmd_spoilers(creature_ptr);
-               break;
-
-               /* Hack -- Help */
-       case '?':
-               do_cmd_help(creature_ptr);
-               break;
-
-               /* Cure all maladies */
        case 'a':
                do_cmd_wiz_cure_all(creature_ptr);
                break;
-
-               /* Know alignment */
        case 'A':
                msg_format("Your alignment is %d.", creature_ptr->align);
                break;
-
-               /* Teleport to target */
        case 'b':
                do_cmd_wiz_bamf(creature_ptr);
                break;
-
        case 'B':
                update_gambling_monsters(creature_ptr);
                break;
-
-               /* Create any object */
        case 'c':
                wiz_create_item(creature_ptr);
                break;
-
-               /* Create a named artifact */
        case 'C':
                wiz_create_named_art(creature_ptr);
                break;
-
-               /* Detect everything */
        case 'd':
                detect_all(creature_ptr, DETECT_RAD_ALL * 3);
                break;
-
-               /* Dimension_door */
        case 'D':
                wiz_dimension_door(creature_ptr);
                break;
-
-               /* Edit character */
        case 'e':
                do_cmd_wiz_change(creature_ptr);
                break;
-
-               /* Blue Mage Only */
        case 'E':
                if (creature_ptr->pclass == CLASS_BLUE_MAGE)
                {
                        do_cmd_wiz_blue_mage(creature_ptr);
                }
-               break;
 
-               /* View item info */
+               break;
        case 'f':
                identify_fully(creature_ptr, FALSE, 0);
                break;
-
-               /* Create desired feature */
        case 'F':
                do_cmd_wiz_create_feature(creature_ptr);
                break;
-
-               /* Good Objects */
        case 'g':
                if (command_arg <= 0) command_arg = 1;
+
                acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, FALSE, FALSE, TRUE);
                break;
-
-               /* Hitpoint rerating */
        case 'h':
                roll_hitdice(creature_ptr, SPOP_DISPLAY_MES | SPOP_DEBUG);
                break;
-
        case 'H':
                do_cmd_summon_horde(creature_ptr);
                break;
-
-               /* Identify */
        case 'i':
                (void)ident_spell(creature_ptr, FALSE, 0);
                break;
-
-               /* Go up or down in the dungeon */
        case 'j':
                do_cmd_wiz_jump(creature_ptr);
                break;
-
-               /* Self-Knowledge */
        case 'k':
                self_knowledge(creature_ptr);
                break;
-
-               /* Learn about objects */
        case 'l':
                do_cmd_wiz_learn(creature_ptr);
                break;
-
-               /* Magic Mapping */
        case 'm':
                map_area(creature_ptr, DETECT_RAD_ALL * 3);
                break;
-
-               /* Mutation */
        case 'M':
                (void)gain_mutation(creature_ptr, command_arg);
                break;
-
-               /* Reset Class */
        case 'R':
                (void)do_cmd_wiz_reset_class(creature_ptr);
                break;
-
-               /* Specific reward */
        case 'r':
                (void)gain_level_reward(creature_ptr, command_arg);
                break;
-
-               /* Summon _friendly_ named monster */
        case 'N':
                do_cmd_wiz_named_friendly(creature_ptr, command_arg);
                break;
-
-               /* Summon Named Monster */
        case 'n':
                do_cmd_wiz_named(creature_ptr, command_arg);
                break;
-
-               /* Dump option bits usage */
        case 'O':
                do_cmd_dump_options();
                break;
-
-               /* Object playing routines */
        case 'o':
                do_cmd_wiz_play(creature_ptr);
                break;
-
-               /* Phase Door */
        case 'p':
                teleport_player(creature_ptr, 10, TELEPORT_SPONTANEOUS);
                break;
-
-               /* Take a Quests */
        case 'Q':
        {
                char ppp[30];
@@ -1900,11 +1583,8 @@ void do_cmd_debug(player_type *creature_ptr)
                parse_fixed_map(creature_ptr, "q_info.txt", 0, 0, 0, 0);
                quest[tmp_int].status = QUEST_STATUS_TAKEN;
                creature_ptr->current_floor_ptr->inside_quest = 0;
+               break;
        }
-
-       break;
-
-       /* Complete a Quest -KMW- */
        case 'q':
                if (creature_ptr->current_floor_ptr->inside_quest)
                {
@@ -1921,74 +1601,44 @@ void do_cmd_debug(player_type *creature_ptr)
                }
 
                break;
-
-               /* Make every dungeon square "known" to test streamers -KMW- */
-       case 'u':
-               for (int y = 0; y < creature_ptr->current_floor_ptr->height; y++)
-               {
-                       for (int x = 0; x < creature_ptr->current_floor_ptr->width; x++)
-                       {
-                               creature_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
-                       }
-               }
-
-               wiz_lite(creature_ptr, FALSE);
-               break;
-
-               /* Summon Random Monster(s) */
        case 's':
                if (command_arg <= 0) command_arg = 1;
                do_cmd_wiz_summon(creature_ptr, command_arg);
                break;
-
-               /* Special(Random Artifact) Objects */
        case 'S':
                if (command_arg <= 0) command_arg = 1;
                acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, TRUE, TRUE);
                break;
-
-               /* Teleport */
        case 't':
                teleport_player(creature_ptr, 100, TELEPORT_SPONTANEOUS);
                break;
-
-               /* Game Time Setting */
        case 'T':
                set_gametime();
                break;
+       case 'u':
+               for (int y = 0; y < creature_ptr->current_floor_ptr->height; y++)
+               {
+                       for (int x = 0; x < creature_ptr->current_floor_ptr->width; x++)
+                       {
+                               creature_ptr->current_floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
+                       }
+               }
 
-               /* Very Good Objects */
+               wiz_lite(creature_ptr, FALSE);
+               break;
        case 'v':
                if (command_arg <= 0) command_arg = 1;
                acquirement(creature_ptr, creature_ptr->y, creature_ptr->x, command_arg, TRUE, FALSE, TRUE);
                break;
-
-               /* Wizard Light the Level */
+       case 'V':
+               do_cmd_wiz_reset_class(creature_ptr);
+               break;
        case 'w':
                wiz_lite(creature_ptr, (bool)(creature_ptr->pclass == CLASS_NINJA));
                break;
-
-               /* Increase Experience */
        case 'x':
                gain_exp(creature_ptr, command_arg ? command_arg : (creature_ptr->exp + 1));
                break;
-
-               /* Zap Monsters (Genocide) */
-       case 'z':
-               do_cmd_wiz_zap(creature_ptr);
-               break;
-
-               /* Zap Monsters (Omnicide) */
-       case 'Z':
-               do_cmd_wiz_zap_all(creature_ptr);
-               break;
-
-               /* Hack -- whatever I desire */
-       case '_':
-               probing(creature_ptr);
-               break;
-
-               /* For temporary test. */
        case 'X':
        {
                INVENTORY_IDX i;
@@ -1996,18 +1646,28 @@ void do_cmd_debug(player_type *creature_ptr)
                {
                        if (creature_ptr->inventory_list[i].k_idx) drop_from_inventory(creature_ptr, i, 999);
                }
+
                player_outfit(creature_ptr);
                break;
        }
-
-       case 'V':
-               do_cmd_wiz_reset_class(creature_ptr);
+       case 'z':
+               do_cmd_wiz_zap(creature_ptr);
+               break;
+       case 'Z':
+               do_cmd_wiz_zap_all(creature_ptr);
+               break;
+       case '_':
+               probing(creature_ptr);
                break;
-
        case '@':
                do_cmd_debug_spell(creature_ptr);
                break;
-
+       case '"':
+               do_cmd_spoilers(creature_ptr);
+               break;
+       case '?':
+               do_cmd_help(creature_ptr);
+               break;
        default:
                msg_print("That is not a valid debug command.");
                break;