1 #include "spell-realm/spells-nature.h"
2 #include "flavor/flavor-describer.h"
3 #include "flavor/object-flavor-types.h"
4 #include "floor/floor-object.h"
5 #include "object-enchant/tr-types.h"
6 #include "object-hook/hook-armor.h"
7 #include "object/item-tester-hooker.h"
8 #include "object/item-use-flags.h"
9 #include "racial/racial-android.h"
10 #include "system/item-entity.h"
11 #include "system/player-type-definition.h"
12 #include "util/bit-flags-calculator.h"
13 #include "view/display-messages.h"
17 * @param player_ptr 錆止め実行者の参照ポインタ
18 * @return ターン消費を要する処理を行ったならばTRUEを返す
20 bool rustproof(PlayerType *player_ptr)
22 constexpr auto q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
23 constexpr auto s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
25 const auto options = USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT;
26 auto *o_ptr = choose_object(player_ptr, &i_idx, q, s, options, FuncItemTester(&ItemEntity::is_protector));
27 if (o_ptr == nullptr) {
31 const auto item_name = describe_flavor(player_ptr, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
32 o_ptr->art_flags.set(TR_IGNORE_ACID);
33 if ((o_ptr->to_a < 0) && !o_ptr->is_cursed()) {
35 msg_format("%sは新品同様になった!", item_name.data());
37 msg_format("%s %s look%s as good as new!", ((i_idx >= 0) ? "Your" : "The"), item_name.data(), ((o_ptr->number > 1) ? "" : "s"));
43 msg_format("%sは腐食しなくなった。", item_name.data());
45 msg_format("%s %s %s now protected against corrosion.", ((i_idx >= 0) ? "Your" : "The"), item_name.data(), ((o_ptr->number > 1) ? "are" : "is"));
47 calc_android_exp(player_ptr);