OSDN Git Service

[Refactor] #40581 Separated drop_artifact() from monster_death()
authorHourier <hourier@users.sourceforge.jp>
Fri, 21 Aug 2020 09:00:11 +0000 (18:00 +0900)
committerHourier <hourier@users.sourceforge.jp>
Fri, 21 Aug 2020 09:00:11 +0000 (18:00 +0900)
15 files changed:
src/cmd-building/cmd-building.h
src/floor/floor-generator.c
src/game-option/birth-options.c
src/game-option/birth-options.h
src/game-option/game-play-options.c
src/game-option/game-play-options.h
src/game-option/play-record-options.c
src/game-option/play-record-options.h
src/market/arena.c
src/monster-floor/monster-death.c
src/player/player-status.h
src/room/rooms-normal.c
src/room/rooms-vault.c
src/system/floor-type-definition.h
src/system/gamevalue.h

index cc0db6d..4414d83 100644 (file)
@@ -23,7 +23,7 @@ extern int sel_monster;
 
 /*!
  * @struct arena_type
- * @brief 闘技場のモンスターエントリー構造体 / A structure type for arena entry
+ * @brief 闘技場のモンスターエントリー構造体 / A structure type for on_defeat_arena_monster entry
  */
 typedef struct arena_type {
        MONRACE_IDX r_idx; /*!< 闘技場のモンスター種族ID(0ならば表彰式) / Monster (0 means victory prizing) */
index f100276..3c3b5b2 100644 (file)
@@ -45,7 +45,7 @@
 #include "world/world.h"
 
 /*!
- * @brief 闘技場用のアリーナ地形を作成する / Builds the arena after it is entered -KMW-
+ * @brief 闘技場用のアリーナ地形を作成する / Builds the on_defeat_arena_monster after it is entered -KMW-
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
@@ -98,7 +98,7 @@ static void build_arena(player_type *player_ptr, POSITION *start_y, POSITION *st
 }
 
 /*!
- * @brief 挑戦時闘技場への入場処理 / Town logic flow for generation of arena -KMW-
+ * @brief 挑戦時闘技場への入場処理 / Town logic flow for generation of on_defeat_arena_monster -KMW-
  * @return なし
  */
 static void generate_challenge_arena(player_type *challanger_ptr)
@@ -131,7 +131,7 @@ static void generate_challenge_arena(player_type *challanger_ptr)
 }
 
 /*!
- * @brief モンスター闘技場のフロア生成 / Builds the arena after it is entered -KMW-
+ * @brief モンスター闘技場のフロア生成 / Builds the on_defeat_arena_monster after it is entered -KMW-
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
@@ -192,7 +192,7 @@ static void build_battle(player_type *player_ptr, POSITION *y, POSITION *x)
 }
 
 /*!
- * @brief モンスター闘技場への導入処理 / Town logic flow for generation of arena -KMW-
+ * @brief モンスター闘技場への導入処理 / Town logic flow for generation of on_defeat_arena_monster -KMW-
  * @return なし
  */
 static void generate_gambling_arena(player_type *creature_ptr)
index 0c6b333..de0f0ca 100644 (file)
@@ -9,7 +9,7 @@ bool lite_town; /* Use 'lite' town without a wilderness */
 bool ironman_shops; /* Stores are permanently closed (*) */
 bool ironman_small_levels; /* Always create unusually small dungeon levels (*) */
 bool ironman_downward; /* Disable recall and use of up stairs (*) */
-bool ironman_empty_levels; /* Always create empty 'arena' levels (*) */
+bool ironman_empty_levels; /* Always create empty 'on_defeat_arena_monster' levels (*) */
 bool ironman_rooms; /* Always generate very unusual rooms (*) */
 bool ironman_nightmare; /* Nightmare mode(it isn't even remotely fair!)(*) */
 bool left_hander; /* Left-Hander */
index 71149e3..a551ac4 100644 (file)
@@ -11,7 +11,7 @@ extern bool lite_town; /* Use 'lite' town without a wilderness */
 extern bool ironman_shops; /* Stores are permanently closed (*) */
 extern bool ironman_small_levels; /* Always create unusually small dungeon levels (*) */
 extern bool ironman_downward; /* Disable recall and use of up stairs (*) */
-extern bool ironman_empty_levels; /* Always create empty 'arena' levels (*) */
+extern bool ironman_empty_levels; /* Always create empty 'on_defeat_arena_monster' levels (*) */
 extern bool ironman_rooms; /* Always generate very unusual rooms (*) */
 extern bool ironman_nightmare; /* Nightmare mode(it isn't even remotely fair!)(*) */
 extern bool left_hander; /* Left-Hander */
index b6c2981..f1a99e4 100644 (file)
@@ -5,7 +5,7 @@ bool stack_force_costs; /* Merge discounts when stacking */
 bool expand_list; /* Expand the power of the list commands */
 bool small_levels; /* Allow unusually small dungeon levels */
 bool always_small_levels; /* Always create unusually small dungeon levels */
-bool empty_levels; /* Allow empty 'arena' levels */
+bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
 bool last_words; /* Leave last words when your character dies */
 #ifdef WORLD_SCORE
index 7f993ac..9b97861 100644 (file)
@@ -7,7 +7,7 @@ extern bool stack_force_costs; /* Merge discounts when stacking */
 extern bool expand_list; /* Expand the power of the list commands */
 extern bool small_levels; /* Allow unusually small dungeon levels */
 extern bool always_small_levels; /* Always create unusually small dungeon levels */
-extern bool empty_levels; /* Allow empty 'arena' levels */
+extern bool empty_levels; /* Allow empty 'on_defeat_arena_monster' levels */
 extern bool bound_walls_perm; /* Boundary walls become 'permanent wall' */
 extern bool last_words; /* Leave last words when your character dies */
 #ifdef WORLD_SCORE
index b321d17..bc8101b 100644 (file)
@@ -10,7 +10,7 @@ bool record_stair; /* Record recall and stair movements */
 bool record_buy; /* Record purchased items */
 bool record_sell; /* Record sold items */
 bool record_danger; /* Record hitpoint warning */
-bool record_arena; /* Record arena victories */
+bool record_arena; /* Record on_defeat_arena_monster victories */
 bool record_ident; /* Record first identified items */
 bool record_named_pet; /* Record information about named pets */
 char record_o_name[MAX_NLEN];
index 0fe23b9..d758539 100644 (file)
@@ -12,7 +12,7 @@ extern bool record_stair; /* Record recall and stair movements */
 extern bool record_buy; /* Record purchased items */
 extern bool record_sell; /* Record sold items */
 extern bool record_danger; /* Record hitpoint warning */
-extern bool record_arena; /* Record arena victories */
+extern bool record_arena; /* Record on_defeat_arena_monster victories */
 extern bool record_ident; /* Record first identified items */
 extern bool record_named_pet; /* Record information about named pets */
 
index b15317e..bd3a0b0 100644 (file)
@@ -134,7 +134,7 @@ static void see_arena_poster(player_type *player_ptr)
 }
 
 /*!
- * @brief 闘技場に入るコマンドの処理 / arena commands
+ * @brief 闘技場に入るコマンドの処理 / on_defeat_arena_monster commands
  * @param player_ptr プレーヤーへの参照ポインタ
  * @param cmd 闘技場処理のID
  * @return なし
@@ -151,7 +151,7 @@ void arena_comm(player_type *player_ptr, int cmd)
     case BACT_ARENA_RULES:
         screen_save();
 
-        /* Peruse the arena help file */
+        /* Peruse the on_defeat_arena_monster help file */
         (void)show_file(player_ptr, TRUE, _("arena_j.txt", "arena.txt"), NULL, 0, 0);
         screen_load();
         break;
index 369c604..fa18138 100644 (file)
@@ -188,6 +188,45 @@ static ARTIFACT_IDX get_artifact_index(player_type *player_ptr, monster_death_ty
     return a_idx;
 }
 
+static void drop_artifact(player_type *player_ptr, monster_death_type *md_ptr)
+{
+    if (!md_ptr->drop_chosen_item)
+        return;
+
+    ARTIFACT_IDX a_idx = get_artifact_index(player_ptr, md_ptr);
+    if (((md_ptr->r_ptr->flags7 & RF7_GUARDIAN) == 0) || (d_info[player_ptr->dungeon_idx].final_guardian != md_ptr->m_ptr->r_idx))
+        return;
+
+    KIND_OBJECT_IDX k_idx
+        = d_info[player_ptr->dungeon_idx].final_object != 0 ? d_info[player_ptr->dungeon_idx].final_object : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
+    if (d_info[player_ptr->dungeon_idx].final_artifact != 0) {
+        a_idx = d_info[player_ptr->dungeon_idx].final_artifact;
+        artifact_type *a_ptr = &a_info[a_idx];
+        if (!a_ptr->cur_num) {
+            if (create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x)) {
+                a_ptr->cur_num = 1;
+                if (current_world_ptr->character_dungeon)
+                    a_ptr->floor_id = player_ptr->floor_id;
+            } else if (!preserve_mode) {
+                a_ptr->cur_num = 1;
+            }
+
+            if (!d_info[player_ptr->dungeon_idx].final_object)
+                k_idx = 0;
+        }
+    }
+
+    if (k_idx != 0) {
+        object_type forge;
+        object_type *q_ptr = &forge;
+        object_prep(player_ptr, q_ptr, k_idx);
+        apply_magic(player_ptr, q_ptr, player_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART | AM_GOOD);
+        (void)drop_near(player_ptr, q_ptr, -1, md_ptr->md_y, md_ptr->md_x);
+    }
+
+    msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[player_ptr->dungeon_idx].name);
+}
+
 /*!
  * @brief モンスターが死亡した時の処理 /
  * Handle the "death" of a monster.
@@ -240,40 +279,7 @@ void monster_death(player_type *player_ptr, MONSTER_IDX m_idx, bool drop_item)
         md_ptr->mo_mode |= AM_GREAT;
 
     switch_special_death(player_ptr, md_ptr);
-    if (md_ptr->drop_chosen_item) {
-        ARTIFACT_IDX a_idx = get_artifact_index(player_ptr, md_ptr);
-        if ((md_ptr->r_ptr->flags7 & RF7_GUARDIAN) && (d_info[player_ptr->dungeon_idx].final_guardian == md_ptr->m_ptr->r_idx)) {
-            KIND_OBJECT_IDX k_idx = d_info[player_ptr->dungeon_idx].final_object != 0 ? d_info[player_ptr->dungeon_idx].final_object
-                                                                                      : lookup_kind(TV_SCROLL, SV_SCROLL_ACQUIREMENT);
-
-            if (d_info[player_ptr->dungeon_idx].final_artifact != 0) {
-                a_idx = d_info[player_ptr->dungeon_idx].final_artifact;
-                artifact_type *a_ptr = &a_info[a_idx];
-                if (!a_ptr->cur_num) {
-                    if (create_named_art(player_ptr, a_idx, md_ptr->md_y, md_ptr->md_x)) {
-                        a_ptr->cur_num = 1;
-                        if (current_world_ptr->character_dungeon)
-                            a_ptr->floor_id = player_ptr->floor_id;
-                    } else if (!preserve_mode) {
-                        a_ptr->cur_num = 1;
-                    }
-
-                    if (!d_info[player_ptr->dungeon_idx].final_object)
-                        k_idx = 0;
-                }
-            }
-
-            if (k_idx != 0) {
-                q_ptr = &forge;
-                object_prep(player_ptr, q_ptr, k_idx);
-                apply_magic(player_ptr, q_ptr, player_ptr->current_floor_ptr->object_level, AM_NO_FIXED_ART | AM_GOOD);
-                (void)drop_near(player_ptr, q_ptr, -1, md_ptr->md_y, md_ptr->md_x);
-            }
-
-            msg_format(_("あなたは%sを制覇した!", "You have conquered %s!"), d_name + d_info[player_ptr->dungeon_idx].name);
-        }
-    }
-
+    drop_artifact(player_ptr, md_ptr);
     int number = 0;
     if ((md_ptr->r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60))
         number++;
@@ -296,7 +302,8 @@ void monster_death(player_type *player_ptr, MONSTER_IDX m_idx, bool drop_item)
     if (md_ptr->cloned && !(md_ptr->r_ptr->flags1 & RF1_UNIQUE))
         number = 0;
 
-    if (is_pet(md_ptr->m_ptr) || player_ptr->phase_out || player_ptr->current_floor_ptr->inside_arena)
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    if (is_pet(md_ptr->m_ptr) || player_ptr->phase_out || floor_ptr->inside_arena)
         number = 0;
 
     if (!drop_item && (md_ptr->r_ptr->d_char != '$'))
index 3bcc248..1592b9f 100644 (file)
@@ -117,7 +117,7 @@ typedef struct player_type {
     PLAYER_LEVEL lev; /* Level */
 
     TOWN_IDX town_num; /* Current town number */
-    s16b arena_number; /* monster number in arena -KMW- */
+    s16b arena_number; /* monster number in on_defeat_arena_monster -KMW- */
     bool phase_out; /*!< フェイズアウト状態(闘技場観戦状態などに利用、NPCの処理の対象にならず自身もほとんどの行動ができない) */
 
     DUNGEON_IDX dungeon_idx; /* current dungeon index */
@@ -312,7 +312,7 @@ typedef struct player_type {
     bool monk_notify_aux;
 
     byte leave_bldg;
-    byte exit_bldg; /* Goal obtained in arena? -KMW- */
+    byte exit_bldg; /* Goal obtained in on_defeat_arena_monster? -KMW- */
 
     bool leaving_dungeon; /* True if player is leaving the dungeon */
     bool teleport_town;
index a27db5a..6b9e2a0 100644 (file)
@@ -896,7 +896,7 @@ bool build_type11(player_type *player_ptr, dun_data_type *dd_ptr)
                 /* inside- so is floor */
                 place_bold(player_ptr, y, x, GB_FLOOR);
             } else if (distance(y0, x0, y, x) <= rad + 1) {
-                /* make granite outside so arena works */
+                /* make granite outside so on_defeat_arena_monster works */
                 place_bold(player_ptr, y, x, GB_EXTRA);
             }
         }
@@ -954,11 +954,11 @@ bool build_type12(player_type *player_ptr, dun_data_type *dd_ptr)
             } else if (distance(y0, x0, y, x) < 3) {
                 place_bold(player_ptr, y, x, GB_FLOOR);
             } else {
-                /* make granite outside so arena works */
+                /* make granite outside so on_defeat_arena_monster works */
                 place_bold(player_ptr, y, x, GB_EXTRA);
             }
 
-            /* proper boundary for arena */
+            /* proper boundary for on_defeat_arena_monster */
             if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) {
                 place_bold(player_ptr, y, x, GB_EXTRA);
             }
index 5d992a2..2deb251 100644 (file)
@@ -183,7 +183,7 @@ static void build_room_vault(player_type *player_ptr, POSITION x0, POSITION y0,
 
     msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("部屋型ランダムVaultを生成しました。", "Room Vault."));
 
-    /* fill area so don't get problems with arena levels */
+    /* fill area so don't get problems with on_defeat_arena_monster levels */
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     for (x1 = 0; x1 < xsize; x1++) {
         POSITION x = x0 - xhsize + x1;
@@ -786,11 +786,11 @@ static void build_target_vault(player_type *player_ptr, POSITION x0, POSITION y0
                 /* inside- so is floor */
                 place_bold(player_ptr, y, x, GB_FLOOR);
             } else {
-                /* make granite outside so arena works */
+                /* make granite outside so on_defeat_arena_monster works */
                 place_bold(player_ptr, y, x, GB_EXTRA);
             }
 
-            /* proper boundary for arena */
+            /* proper boundary for on_defeat_arena_monster */
             if (((y + rad) == y0) || ((y - rad) == y0) || ((x + rad) == x0) || ((x - rad) == x0)) {
                 place_bold(player_ptr, y, x, GB_EXTRA);
             }
index 4fac90b..ec5cd0a 100644 (file)
@@ -49,6 +49,6 @@ typedef struct floor_type {
 
     bool monster_noise;
     QUEST_IDX inside_quest; /* Inside quest level */
-    bool inside_arena; /* Is character inside arena? */
+    bool inside_arena; /* Is character inside on_defeat_arena_monster? */
 
 } floor_type;
index 5de40f5..afac5cd 100644 (file)
@@ -59,7 +59,7 @@
 #define SMALL_LEVEL 3   /*!< 小さいフロアの生成される基本確率(1/定数) / 1/chance of smaller size (3) */
 #define EMPTY_LEVEL 24  /*!< アリーナレベル(外壁のないフロア)の生成される基本確率(1/定数) / 1/chance of being 'empty' (15) */
 #define LAKE_LEVEL  24  /*!< 川や湖のあるフロアの生成される確率(1/定数) / 1/chance of being a lake on the level */
-#define DARK_EMPTY  5   /*!< フロア全体が暗い可能性の基本確率(1/定数) / 1/chance of arena level NOT being lit (2) */
+#define DARK_EMPTY  5   /*!< フロア全体が暗い可能性の基本確率(1/定数) / 1/chance of on_defeat_arena_monster level NOT being lit (2) */
 #define DUN_CAVERN  20 /*!< 洞窟状のダンジョンが生成される基本確率(1/定数) / 1/chance of having a cavern level */
 
 /*