OSDN Git Service

[Feature] #39581 広域マップでは変異による武器ドロップ処理が起こらないよう変更.当該処理を drop_weapons() に分離. / In wild...
authordeskull <deskull@users.sourceforge.jp>
Sun, 8 Mar 2020 13:53:24 +0000 (22:53 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 8 Mar 2020 13:55:01 +0000 (22:55 +0900)
src/core.c
src/player-effects.c
src/player-effects.h
src/wizard2.c

index b7a9c8c..7aaa8ab 100644 (file)
@@ -2225,35 +2225,10 @@ static void process_world_aux_mutation(player_type *creature_ptr)
 
        if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
        {
-               INVENTORY_IDX slot = 0;
-               object_type *o_ptr = NULL;
-
                disturb(creature_ptr, FALSE, TRUE);
                msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
                take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
-
-               msg_print(NULL);
-               if (has_melee_weapon(creature_ptr, INVEN_RARM))
-               {
-                       slot = INVEN_RARM;
-                       o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
-
-                       if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
-                       {
-                               o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
-                               slot = INVEN_LARM;
-                       }
-               }
-               else if (has_melee_weapon(creature_ptr, INVEN_LARM))
-               {
-                       o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
-                       slot = INVEN_LARM;
-               }
-               if (slot && !object_is_cursed(o_ptr))
-               {
-                       msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
-                       drop_from_inventory(creature_ptr, slot, 1);
-               }
+               drop_weapons(creature_ptr);
        }
 }
 
index 98af10f..97acc4a 100644 (file)
@@ -3809,3 +3809,38 @@ bool choose_ele_immune(player_type *creature_ptr, TIME_EFFECT immune_turn)
        screen_load();
        return TRUE;
 }
+
+bool_hack drop_weapons(player_type *creature_ptr)
+{
+       INVENTORY_IDX slot = 0;
+       object_type *o_ptr = NULL;
+
+       if (creature_ptr->wild_mode) return FALSE;
+
+       msg_print(NULL);
+       if (has_melee_weapon(creature_ptr, INVEN_RARM))
+       {
+               slot = INVEN_RARM;
+               o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
+
+               if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
+               {
+                       o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
+                       slot = INVEN_LARM;
+               }
+       }
+       else if (has_melee_weapon(creature_ptr, INVEN_LARM))
+       {
+               o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
+               slot = INVEN_LARM;
+       }
+
+       if (slot && !object_is_cursed(o_ptr))
+       {
+               msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
+               drop_from_inventory(creature_ptr, slot, 1);
+               return TRUE;
+       }
+
+       return FALSE;
+}
index c35e9c3..071de3c 100644 (file)
@@ -82,6 +82,7 @@ extern bool set_tim_esp(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
 extern bool set_superstealth(player_type *creature_ptr, bool set);
 extern void do_poly_wounds(player_type *creature_ptr);
 extern void change_race(player_type *creature_ptr, CHARACTER_IDX new_race, concptr effect_msg);
+extern bool_hack drop_weapons(player_type *creature_ptr);
 
 extern const kamae kamae_shurui[MAX_KAMAE];
 extern const kamae kata_shurui[MAX_KATA];
index 33d07b0..9c88427 100644 (file)
@@ -72,11 +72,12 @@ typedef struct debug_spell_command
        spell_functions command_function;
 } debug_spell_command;
 
-#define SPELL_MAX 2
+#define SPELL_MAX 3
 debug_spell_command debug_spell_commands_list[SPELL_MAX] =
 {
        { 2, "vanish dungeon", {.spell2 = { vanish_dungeon } } },
-       { 3, "true healing", {.spell3 = { true_healing } } }
+       { 3, "true healing", {.spell3 = { true_healing } } },
+       { 2, "drop weapons", {.spell2 = { drop_weapons } } }
 };
 
 /*!
@@ -88,7 +89,7 @@ static bool do_cmd_debug_spell(player_type *creature_ptr)
        char tmp_val[50] = "\0";
        int tmp_int;
 
-       if (!get_string("SPELL:", tmp_val, 32)) return FALSE;
+       if (!get_string("SPELL: ", tmp_val, 32)) return FALSE;
 
        for (int i = 0; i < SPELL_MAX; i++)
        {
@@ -98,18 +99,22 @@ static bool do_cmd_debug_spell(player_type *creature_ptr)
                {
                case 2:
                        (*(debug_spell_commands_list[i].command_function.spell2.spell_function))(creature_ptr);
+                       return TRUE;
                        break;
                case 3:
                        tmp_val[0] = '\0';
                        if (!get_string("POWER:", tmp_val, 32)) return FALSE;
                        tmp_int = atoi(tmp_val);
                        (*(debug_spell_commands_list[i].command_function.spell3.spell_function))(creature_ptr, tmp_int);
+                       return TRUE;
                        break;
                default:
                        break;
                }
        }
 
+       msg_format("Command not found.");
+
        return FALSE;
 }