7 #include "autopick/autopick-destroyer.h"
8 #include "autopick-methods-table.h"
9 #include "autopick/autopick-util.h"
10 #include "core/disturbance.h"
11 #include "core/player-update-types.h"
12 #include "flavor/flavor-describer.h"
13 #include "game-option/auto-destruction-options.h"
14 #include "game-option/input-options.h"
15 #include "monster-race/monster-race.h"
16 #include "object-enchant/object-ego.h"
17 #include "object-enchant/special-object-flags.h"
18 #include "object-hook/hook-expendable.h"
19 #include "object-hook/hook-quest.h"
20 #include "object-hook/hook-weapon.h"
21 #include "object/object-mark-types.h"
22 #include "object/object-value.h"
23 #include "perception/object-perception.h"
24 #include "player/player-race-types.h"
25 #include "sv-definition/sv-other-types.h"
26 #include "sv-definition/sv-wand-types.h"
27 #include "system/monster-race-definition.h"
28 #include "system/object-type-definition.h"
29 #include "system/player-type-definition.h"
30 #include "util/string-processor.h"
31 #include "view/display-messages.h"
34 * @brief クラス依存のアイテム破壊を調べる
35 * @param player_ptr プレーヤーへの参照ポインタ
36 * @param o_ptr アイテムへの参照ポインタ
37 * @return 特別なクラス、かつそのクラス特有のアイテムであればFALSE、それ以外はTRUE
39 static bool is_leave_special_item(player_type *player_ptr, object_type *o_ptr)
44 if (player_ptr->prace == RACE_BALROG) {
45 if (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE && angband_strchr("pht", r_info[o_ptr->pval].d_char))
47 } else if (player_ptr->pclass == CLASS_ARCHER) {
48 if (o_ptr->tval == TV_SKELETON || (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
50 } else if (player_ptr->pclass == CLASS_NINJA) {
51 if (o_ptr->tval == TV_LITE && o_ptr->name2 == EGO_LITE_DARKNESS && object_is_known(o_ptr))
53 } else if (player_ptr->pclass == CLASS_BEASTMASTER || player_ptr->pclass == CLASS_CAVALRY) {
54 if (o_ptr->tval == TV_WAND && o_ptr->sval == SV_WAND_HEAL_MONSTER && object_is_aware(o_ptr))
62 * Automatically destroy items in this grid.
64 static bool is_opt_confirm_destroy(player_type *player_ptr, object_type *o_ptr)
70 if (object_value(player_ptr, o_ptr) > 0)
74 if (object_is_weapon_armour_ammo(player_ptr, o_ptr))
78 if ((o_ptr->tval == TV_CHEST) && o_ptr->pval)
82 if (object_is_bounty(player_ptr, o_ptr))
86 if (o_ptr->tval == TV_CORPSE)
90 if ((o_ptr->tval == TV_SKELETON) || (o_ptr->tval == TV_BOTTLE) || (o_ptr->tval == TV_JUNK) || (o_ptr->tval == TV_STATUE))
93 if (!is_leave_special_item(player_ptr, o_ptr))
96 if (o_ptr->tval == TV_GOLD)
102 void auto_destroy_item(player_type *player_ptr, object_type *o_ptr, int autopick_idx)
104 bool destroy = false;
105 if (is_opt_confirm_destroy(player_ptr, o_ptr))
108 if (autopick_idx >= 0 && !(autopick_list[autopick_idx].action & DO_AUTODESTROY))
111 if (!always_pickup) {
112 if (autopick_idx >= 0 && (autopick_list[autopick_idx].action & DO_AUTODESTROY))
119 disturb(player_ptr, false, false);
120 if (!can_player_destroy_object(player_ptr, o_ptr)) {
121 GAME_TEXT o_name[MAX_NLEN];
122 describe_flavor(player_ptr, o_name, o_ptr, 0);
123 msg_format(_("%sは破壊不能だ。", "You cannot auto-destroy %s."), o_name);
127 (void)COPY(&autopick_last_destroyed_object, o_ptr, object_type);
128 o_ptr->marked |= OM_AUTODESTROY;
129 player_ptr->update |= PU_AUTODESTROY;