2 * @file weapon-shield.cpp
6 #include "action/weapon-shield.h"
7 #include "flavor/flavor-describer.h"
8 #include "game-option/birth-options.h"
9 #include "inventory/inventory-object.h"
10 #include "inventory/inventory-slot-types.h"
11 #include "object-hook/hook-weapon.h"
12 #include "player-info/equipment-info.h"
13 #include "player-status/player-hand-types.h"
14 #include "system/object-type-definition.h"
15 #include "system/player-type-definition.h"
16 #include "view/display-messages.h"
20 * @param player_ptr プレイヤーへの参照ポインタ
21 * @param item 持ち替えを行いたい装備部位ID
23 void verify_equip_slot(PlayerType *player_ptr, INVENTORY_IDX item)
25 object_type *o_ptr, *new_o_ptr;
26 GAME_TEXT o_name[MAX_NLEN];
28 if (item == INVEN_MAIN_HAND) {
29 if (!has_melee_weapon(player_ptr, INVEN_SUB_HAND))
32 o_ptr = &player_ptr->inventory_list[INVEN_SUB_HAND];
33 describe_flavor(player_ptr, o_name, o_ptr, 0);
35 if (o_ptr->is_cursed()) {
36 if (o_ptr->allow_two_hands_wielding() && can_two_hands_wielding(player_ptr))
37 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
41 new_o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
42 new_o_ptr->copy_from(o_ptr);
43 inven_item_increase(player_ptr, INVEN_SUB_HAND, -((int)o_ptr->number));
44 inven_item_optimize(player_ptr, INVEN_SUB_HAND);
45 if (o_ptr->allow_two_hands_wielding() && can_two_hands_wielding(player_ptr))
46 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
48 msg_format(_("%sを%sで構えた。", "You are wielding %s in your %s hand."), o_name, (left_hander ? _("左手", "left") : _("右手", "right")));
52 if (item != INVEN_SUB_HAND)
55 o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
57 describe_flavor(player_ptr, o_name, o_ptr, 0);
59 if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND)) {
60 if (o_ptr->allow_two_hands_wielding() && can_two_hands_wielding(player_ptr))
61 msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name);
66 if ((empty_hands(player_ptr, false) & EMPTY_HAND_MAIN) || o_ptr->is_cursed())
69 new_o_ptr = &player_ptr->inventory_list[INVEN_SUB_HAND];
70 new_o_ptr->copy_from(o_ptr);
71 inven_item_increase(player_ptr, INVEN_MAIN_HAND, -((int)o_ptr->number));
72 inven_item_optimize(player_ptr, INVEN_MAIN_HAND);
73 msg_format(_("%sを持ち替えた。", "You switched hand of %s."), o_name);