From: Habu Date: Sat, 30 Jan 2021 08:11:41 +0000 (+0900) Subject: [refactor] 右手/左手に関する関数名を変更 X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=5d618a3f8283d5027034fb2eee8a6d3d00612697 [refactor] 右手/左手に関する関数名を変更 左利き設定を考慮し、関数名のright_handをmain_hand、left_handをsub_handとする。 また、has_right_hand_weaponはその関数名と裏腹に素手攻撃が可能でもTRUEとなり 現実に即していないので、can_attack_with_main_hand と挙動通りの名称にする。 --- diff --git a/src/cmd-action/cmd-attack.c b/src/cmd-action/cmd-attack.c index 34be101a2..ee5125fff 100644 --- a/src/cmd-action/cmd-attack.c +++ b/src/cmd-action/cmd-attack.c @@ -169,7 +169,7 @@ bool do_cmd_attack(player_type *attacker_ptr, POSITION y, POSITION x, combat_opt take_turn(attacker_ptr, 100); - if (!has_right_hand_weapon(attacker_ptr) && !has_left_hand_weapon(attacker_ptr) + if (!can_attack_with_main_hand(attacker_ptr) && !can_attack_with_sub_hand(attacker_ptr) && !(attacker_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES))) { msg_format(_("%s攻撃できない。", "You cannot do attacking."), (empty_hands(attacker_ptr, FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : ""); return FALSE; @@ -238,7 +238,7 @@ bool do_cmd_attack(player_type *attacker_ptr, POSITION y, POSITION x, combat_opt chg_virtue(attacker_ptr, V_HONOUR, -1); } - if (has_right_hand_weapon(attacker_ptr) && has_left_hand_weapon(attacker_ptr)) { + if (can_attack_with_main_hand(attacker_ptr) && can_attack_with_sub_hand(attacker_ptr)) { if ((attacker_ptr->skill_exp[GINOU_NITOURYU] < s_info[attacker_ptr->pclass].s_max[GINOU_NITOURYU]) && ((attacker_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level)) { if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER) @@ -281,9 +281,9 @@ bool do_cmd_attack(player_type *attacker_ptr, POSITION y, POSITION x, combat_opt attacker_ptr->riding_t_m_idx = g_ptr->m_idx; bool fear = FALSE; bool mdeath = FALSE; - if (has_right_hand_weapon(attacker_ptr)) + if (can_attack_with_main_hand(attacker_ptr)) exe_player_attack_to_monster(attacker_ptr, y, x, &fear, &mdeath, 0, mode); - if (has_left_hand_weapon(attacker_ptr) && !mdeath) + if (can_attack_with_sub_hand(attacker_ptr) && !mdeath) exe_player_attack_to_monster(attacker_ptr, y, x, &fear, &mdeath, 1, mode); if (!mdeath) { diff --git a/src/cmd-action/cmd-pet.c b/src/cmd-action/cmd-pet.c index 3d572ecfb..de5b066c6 100644 --- a/src/cmd-action/cmd-pet.c +++ b/src/cmd-action/cmd-pet.c @@ -496,9 +496,9 @@ void do_cmd_pet(player_type *creature_ptr) powers[num++] = PET_NAME; if (creature_ptr->riding) { - if ((has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB) + if ((can_attack_with_main_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB) && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_MAIN_HAND])) - || (has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN) + || (can_attack_with_sub_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN) && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_SUB_HAND]))) { if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) { power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding"); diff --git a/src/combat/attack-accuracy.c b/src/combat/attack-accuracy.c index 188329d5a..5bc4fdea3 100644 --- a/src/combat/attack-accuracy.c +++ b/src/combat/attack-accuracy.c @@ -112,7 +112,7 @@ static bool decide_attack_hit(player_type *attacker_ptr, player_attack_type *pa_ if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) || (pa_ptr->mode == HISSATSU_KYUSHO)) { int n = 1; - if (has_right_hand_weapon(attacker_ptr) && has_left_hand_weapon(attacker_ptr)) + if (can_attack_with_main_hand(attacker_ptr) && can_attack_with_sub_hand(attacker_ptr)) n *= 2; if (pa_ptr->mode == HISSATSU_3DAN) diff --git a/src/inventory/floor-item-getter.c b/src/inventory/floor-item-getter.c index 000d709dc..e8d7c35ca 100644 --- a/src/inventory/floor-item-getter.c +++ b/src/inventory/floor-item-getter.c @@ -240,10 +240,10 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp fis_ptr->e2--; if (fis_ptr->equip && has_two_handed_weapons(owner_ptr) && !(fis_ptr->mode & IGNORE_BOTHHAND_SLOT)) { - if (has_right_hand_weapon(owner_ptr)) { + if (can_attack_with_main_hand(owner_ptr)) { if (fis_ptr->e2 < INVEN_SUB_HAND) fis_ptr->e2 = INVEN_SUB_HAND; - } else if (has_left_hand_weapon(owner_ptr)) + } else if (can_attack_with_sub_hand(owner_ptr)) fis_ptr->e1 = INVEN_MAIN_HAND; } diff --git a/src/inventory/inventory-describer.c b/src/inventory/inventory-describer.c index 88a391c09..ec4cc0710 100644 --- a/src/inventory/inventory-describer.c +++ b/src/inventory/inventory-describer.c @@ -20,23 +20,25 @@ concptr mention_use(player_type *owner_ptr, int i) switch (i) { #ifdef JP case INVEN_MAIN_HAND: - p = owner_ptr->heavy_wield[0] ? "運搬中" - : ((has_two_handed_weapons(owner_ptr) && has_right_hand_weapon(owner_ptr)) ? " 両手" : (left_hander ? " 左手" : " 右手")); + p = owner_ptr->heavy_wield[0] + ? "運搬中" + : ((has_two_handed_weapons(owner_ptr) && can_attack_with_main_hand(owner_ptr)) ? " 両手" : (left_hander ? " 左手" : " 右手")); break; #else case INVEN_MAIN_HAND: - p = owner_ptr->heavy_wield[0] ? "Just lifting" : (has_right_hand_weapon(owner_ptr) ? "Wielding" : "On arm"); + p = owner_ptr->heavy_wield[0] ? "Just lifting" : (can_attack_with_main_hand(owner_ptr) ? "Wielding" : "On arm"); break; #endif #ifdef JP case INVEN_SUB_HAND: - p = owner_ptr->heavy_wield[1] ? "運搬中" - : ((has_two_handed_weapons(owner_ptr) && has_left_hand_weapon(owner_ptr)) ? " 両手" : (left_hander ? " 右手" : " 左手")); + p = owner_ptr->heavy_wield[1] + ? "運搬中" + : ((has_two_handed_weapons(owner_ptr) && can_attack_with_sub_hand(owner_ptr)) ? " 両手" : (left_hander ? " 右手" : " 左手")); break; #else case INVEN_SUB_HAND: - p = owner_ptr->heavy_wield[1] ? "Just lifting" : (has_left_hand_weapon(owner_ptr) ? "Wielding" : "On arm"); + p = owner_ptr->heavy_wield[1] ? "Just lifting" : (can_attack_with_sub_hand(owner_ptr) ? "Wielding" : "On arm"); break; #endif @@ -94,12 +96,12 @@ concptr describe_use(player_type *owner_ptr, int i) case INVEN_MAIN_HAND: p = owner_ptr->heavy_wield[0] ? "運搬中の" - : ((has_two_handed_weapons(owner_ptr) && has_right_hand_weapon(owner_ptr)) ? "両手に装備している" - : (left_hander ? "左手に装備している" : "右手に装備している")); + : ((has_two_handed_weapons(owner_ptr) && can_attack_with_main_hand(owner_ptr)) ? "両手に装備している" + : (left_hander ? "左手に装備している" : "右手に装備している")); break; #else case INVEN_MAIN_HAND: - p = owner_ptr->heavy_wield[0] ? "just lifting" : (has_right_hand_weapon(owner_ptr) ? "attacking monsters with" : "wearing on your arm"); + p = owner_ptr->heavy_wield[0] ? "just lifting" : (can_attack_with_main_hand(owner_ptr) ? "attacking monsters with" : "wearing on your arm"); break; #endif @@ -107,12 +109,12 @@ concptr describe_use(player_type *owner_ptr, int i) case INVEN_SUB_HAND: p = owner_ptr->heavy_wield[1] ? "運搬中の" - : ((has_two_handed_weapons(owner_ptr) && has_left_hand_weapon(owner_ptr)) ? "両手に装備している" - : (left_hander ? "右手に装備している" : "左手に装備している")); + : ((has_two_handed_weapons(owner_ptr) && can_attack_with_sub_hand(owner_ptr)) ? "両手に装備している" + : (left_hander ? "右手に装備している" : "左手に装備している")); break; #else case INVEN_SUB_HAND: - p = owner_ptr->heavy_wield[1] ? "just lifting" : (has_left_hand_weapon(owner_ptr) ? "attacking monsters with" : "wearing on your arm"); + p = owner_ptr->heavy_wield[1] ? "just lifting" : (can_attack_with_sub_hand(owner_ptr) ? "attacking monsters with" : "wearing on your arm"); break; #endif diff --git a/src/inventory/item-getter.c b/src/inventory/item-getter.c index 74fb2992e..5334f58e1 100644 --- a/src/inventory/item-getter.c +++ b/src/inventory/item-getter.c @@ -230,10 +230,10 @@ bool get_item(player_type *owner_ptr, OBJECT_IDX *cp, concptr pmt, concptr str, item_selection_ptr->e2--; if (item_selection_ptr->equip && has_two_handed_weapons(owner_ptr) && !(item_selection_ptr->mode & IGNORE_BOTHHAND_SLOT)) { - if (has_right_hand_weapon(owner_ptr)) { + if (can_attack_with_main_hand(owner_ptr)) { if (item_selection_ptr->e2 < INVEN_SUB_HAND) item_selection_ptr->e2 = INVEN_SUB_HAND; - } else if (has_left_hand_weapon(owner_ptr)) + } else if (can_attack_with_sub_hand(owner_ptr)) item_selection_ptr->e1 = INVEN_MAIN_HAND; } diff --git a/src/io-dump/character-dump.c b/src/io-dump/character-dump.c index 29d2e5159..c5a29c344 100644 --- a/src/io-dump/character-dump.c +++ b/src/io-dump/character-dump.c @@ -470,7 +470,7 @@ static void dump_aux_equipment_inventory(player_type *creature_ptr, FILE *fff) fprintf(fff, _(" [キャラクタの装備]\n\n", " [Character Equipment]\n\n")); for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { describe_flavor(creature_ptr, o_name, &creature_ptr->inventory_list[i], 0); - if ((((i == INVEN_MAIN_HAND) && has_left_hand_weapon(creature_ptr)) || ((i == INVEN_SUB_HAND) && has_right_hand_weapon(creature_ptr))) + if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(creature_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(creature_ptr))) && has_two_handed_weapons(creature_ptr)) strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)")); diff --git a/src/player-attack/player-attack.c b/src/player-attack/player-attack.c index b0a79f787..399ea60c7 100644 --- a/src/player-attack/player-attack.c +++ b/src/player-attack/player-attack.c @@ -337,7 +337,7 @@ static bool check_fear_death(player_type *attacker_ptr, player_attack_type *pa_p *(pa_ptr->mdeath) = TRUE; if ((attacker_ptr->pclass == CLASS_BERSERKER) && attacker_ptr->energy_use) { - if (has_right_hand_weapon(attacker_ptr) && has_left_hand_weapon(attacker_ptr)) { + if (can_attack_with_main_hand(attacker_ptr) && can_attack_with_sub_hand(attacker_ptr)) { if (pa_ptr->hand) attacker_ptr->energy_use = attacker_ptr->energy_use * 3 / 5 + attacker_ptr->energy_use * num * 2 / (attacker_ptr->num_blow[pa_ptr->hand] * 5); else diff --git a/src/player/permanent-resistances.c b/src/player/permanent-resistances.c index 8864939b0..abd019758 100644 --- a/src/player/permanent-resistances.c +++ b/src/player/permanent-resistances.c @@ -61,8 +61,8 @@ static void add_class_flags(player_type *creature_ptr, BIT_FLAGS *flags) if (heavy_armor(creature_ptr)) { add_flag(flags, TR_SPEED); } else { - if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || has_right_hand_weapon(creature_ptr)) - && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || has_left_hand_weapon(creature_ptr))) + if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr)) + && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) add_flag(flags, TR_SPEED); if (creature_ptr->lev > 24 && !creature_ptr->icky_wield[0] && !creature_ptr->icky_wield[1]) add_flag(flags, TR_FREE_ACT); diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index 863c255ab..5c2e64b04 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -526,8 +526,8 @@ BIT_FLAGS has_free_act(player_type *creature_ptr) } if (creature_ptr->pclass == CLASS_NINJA && !heavy_armor(creature_ptr) - && (!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || has_right_hand_weapon(creature_ptr)) - && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || has_left_hand_weapon(creature_ptr))) { + && (!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr)) + && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) { if (creature_ptr->lev > 24) result |= 0x01 << FLAG_CAUSE_CLASS; } @@ -1531,25 +1531,28 @@ melee_type player_melee_type(player_type *creature_ptr) } /* - * @brief 右手(利き手)が武器を持っているかどうかを判定する + * @brief 利き手で攻撃可能かどうかを判定する + * 利き手で攻撃可能とは、利き手に武器を持っているか、 + * 利き手が素手かつ左手も素手もしくは盾を装備している事を意味する。 * @detail Includes martial arts and hand combats as weapons. */ -bool has_right_hand_weapon(player_type *creature_ptr) +bool can_attack_with_main_hand(player_type *creature_ptr) { if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)) return TRUE; - if ((empty_hands(creature_ptr, TRUE) & EMPTY_HAND_MAIN) && !has_left_hand_weapon(creature_ptr)) + if ((empty_hands(creature_ptr, TRUE) & EMPTY_HAND_MAIN) && !can_attack_with_sub_hand(creature_ptr)) return TRUE; return FALSE; } /* - * @brief 左手(非利き手)が武器を持っているかどうかを判定する + * @brief 非利き手で攻撃可能かどうかを判定する + * 非利き手で攻撃可能とは、非利き手に武器を持っている事に等しい * @detail Exclude martial arts and hand combats from weapons. */ -bool has_left_hand_weapon(player_type *creature_ptr) { return has_melee_weapon(creature_ptr, INVEN_SUB_HAND); } +bool can_attack_with_sub_hand(player_type *creature_ptr) { return has_melee_weapon(creature_ptr, INVEN_SUB_HAND); } /* * @brief 両手持ち状態かどうかを判定する @@ -1557,10 +1560,10 @@ bool has_left_hand_weapon(player_type *creature_ptr) { return has_melee_weapon(c bool has_two_handed_weapons(player_type *creature_ptr) { if (can_two_hands_wielding(creature_ptr)) { - if (has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB) + if (can_attack_with_main_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB) && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_MAIN_HAND])) { return TRUE; - } else if (has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN) + } else if (can_attack_with_sub_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN) && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_SUB_HAND])) { return TRUE; } @@ -1696,4 +1699,4 @@ BIT_FLAGS player_aggravate_state(player_type *creature_ptr) return AGGRAVATE_NONE; } -bool has_aggravate(player_type *creature_ptr) { return player_aggravate_state(creature_ptr) == AGGRAVATE_NORMAL; } \ No newline at end of file +bool has_aggravate(player_type *creature_ptr) { return player_aggravate_state(creature_ptr) == AGGRAVATE_NORMAL; } diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index 3681dd598..113e24bd5 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -119,8 +119,8 @@ BIT_FLAGS has_immune_elec(player_type *creature_ptr); BIT_FLAGS has_immune_fire(player_type *creature_ptr); BIT_FLAGS has_immune_cold(player_type *creature_ptr); BIT_FLAGS has_immune_dark(player_type *creature_ptr); -bool has_right_hand_weapon(player_type *creature_ptr); -bool has_left_hand_weapon(player_type *creature_ptr); +bool can_attack_with_main_hand(player_type *creature_ptr); +bool can_attack_with_sub_hand(player_type *creature_ptr); bool has_two_handed_weapons(player_type *creature_ptr); BIT_FLAGS has_lite(player_type *creature_ptr); bool has_disable_two_handed_bonus(player_type *creature_ptr, int i); diff --git a/src/player/player-status.c b/src/player/player-status.c index 4ec506e86..599aa2d3a 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -1271,8 +1271,8 @@ static ACTION_SKILL_POWER calc_stealth(player_type *creature_ptr) if (creature_ptr->pclass == CLASS_NINJA) { if (heavy_armor(creature_ptr)) { pow -= (creature_ptr->lev) / 10; - } else if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || has_right_hand_weapon(creature_ptr)) - && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || has_left_hand_weapon(creature_ptr))) { + } else if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr)) + && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) { pow += (creature_ptr->lev) / 10; } } @@ -1652,7 +1652,7 @@ static ACTION_SKILL_POWER calc_skill_dig(player_type *creature_ptr) static bool is_martial_arts_mode(player_type *creature_ptr) { return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) || (creature_ptr->pclass == CLASS_BERSERKER)) - && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_MAIN) && !has_left_hand_weapon(creature_ptr); + && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_MAIN) && !can_attack_with_sub_hand(creature_ptr); } static s16b calc_num_blow(player_type *creature_ptr, int i) @@ -2456,8 +2456,8 @@ static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value) } if (creature_ptr->pclass == CLASS_NINJA) { - if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || has_right_hand_weapon(creature_ptr)) - && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || has_left_hand_weapon(creature_ptr))) { + if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr)) + && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) { ac += creature_ptr->lev / 2 + 5; } } @@ -2539,8 +2539,8 @@ static s16b calc_speed(player_type *creature_ptr) if (creature_ptr->pclass == CLASS_NINJA) { if (heavy_armor(creature_ptr)) { pow -= (creature_ptr->lev) / 10; - } else if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || has_right_hand_weapon(creature_ptr)) - && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || has_left_hand_weapon(creature_ptr))) { + } else if ((!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx || can_attack_with_main_hand(creature_ptr)) + && (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx || can_attack_with_sub_hand(creature_ptr))) { pow += 3; if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE) || (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN))) @@ -2932,7 +2932,7 @@ static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool i damage -= 2; } else if (creature_ptr->pclass == CLASS_BERSERKER) { damage += creature_ptr->lev / 6; - if (((calc_hand == PLAYER_HAND_MAIN) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) { + if (((calc_hand == PLAYER_HAND_MAIN) && !can_attack_with_sub_hand(creature_ptr)) || has_two_handed_weapons(creature_ptr)) { damage += creature_ptr->lev / 6; } } else if (creature_ptr->pclass == CLASS_SORCERER) { @@ -3146,7 +3146,7 @@ static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_t hit -= 2; } else if (creature_ptr->pclass == CLASS_BERSERKER) { hit += creature_ptr->lev / 5; - if (((calc_hand == PLAYER_HAND_MAIN) && !has_left_hand_weapon(creature_ptr)) || has_two_handed_weapons(creature_ptr)) { + if (((calc_hand == PLAYER_HAND_MAIN) && !can_attack_with_sub_hand(creature_ptr)) || has_two_handed_weapons(creature_ptr)) { hit += creature_ptr->lev / 5; } } else if (creature_ptr->pclass == CLASS_SORCERER) { diff --git a/src/view/display-player-middle.c b/src/view/display-player-middle.c index e900d4fe8..f781bce27 100644 --- a/src/view/display-player-middle.c +++ b/src/view/display-player-middle.c @@ -56,9 +56,9 @@ static void display_player_melee_bonus(player_type *creature_ptr, int hand, int * @param creature_ptr プレーヤーへの参照ポインタ * @return なし */ -static void display_left_hand(player_type *creature_ptr) +static void display_sub_hand(player_type *creature_ptr) { - if (has_left_hand_weapon(creature_ptr)) { + if (can_attack_with_sub_hand(creature_ptr)) { display_player_melee_bonus(creature_ptr, 1, left_hander ? ENTRY_RIGHT_HAND2 : ENTRY_LEFT_HAND2); return; } @@ -291,10 +291,10 @@ static void display_real_playtime(void) */ void display_player_middle(player_type *creature_ptr) { - if (has_right_hand_weapon(creature_ptr)) + if (can_attack_with_main_hand(creature_ptr)) display_player_melee_bonus(creature_ptr, 0, left_hander ? ENTRY_LEFT_HAND1 : ENTRY_RIGHT_HAND1); - display_left_hand(creature_ptr); + display_sub_hand(creature_ptr); display_hit_damage(creature_ptr); display_shoot_magnification(creature_ptr); display_player_one_line(ENTRY_BASE_AC, format("[%d,%+d]", creature_ptr->dis_ac, creature_ptr->dis_to_a), TERM_L_BLUE); diff --git a/src/view/status-first-page.c b/src/view/status-first-page.c index 67ca0df92..fe0097591 100644 --- a/src/view/status-first-page.c +++ b/src/view/status-first-page.c @@ -307,8 +307,8 @@ static void display_first_page(player_type *creature_ptr, int xthb, int *damage, if (creature_ptr->muta2 & MUT2_TENTACLES) muta_att++; - int blows1 = has_right_hand_weapon(creature_ptr) ? creature_ptr->num_blow[0] : 0; - int blows2 = has_left_hand_weapon(creature_ptr) ? creature_ptr->num_blow[1] : 0; + int blows1 = can_attack_with_main_hand(creature_ptr) ? creature_ptr->num_blow[0] : 0; + int blows2 = can_attack_with_sub_hand(creature_ptr) ? creature_ptr->num_blow[1] : 0; int xdis = creature_ptr->skill_dis; int xdev = creature_ptr->skill_dev; int xsav = creature_ptr->skill_sav; diff --git a/src/window/display-sub-windows.c b/src/window/display-sub-windows.c index 78a0e5670..1f1230b75 100644 --- a/src/window/display-sub-windows.c +++ b/src/window/display-sub-windows.c @@ -216,7 +216,8 @@ static void display_equipment(player_type *owner_ptr, tval_type tval) } term_putstr(0, i - INVEN_MAIN_HAND, 3, TERM_WHITE, tmp_val); - if ((((i == INVEN_MAIN_HAND) && has_left_hand_weapon(owner_ptr)) || ((i == INVEN_SUB_HAND) && has_right_hand_weapon(owner_ptr))) && has_two_handed_weapons(owner_ptr)) { + if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr))) + && has_two_handed_weapons(owner_ptr)) { strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)")); attr = TERM_WHITE; } else { diff --git a/src/window/main-window-equipments.c b/src/window/main-window-equipments.c index 369b9dc4f..de83afd48 100644 --- a/src/window/main-window-equipments.c +++ b/src/window/main-window-equipments.c @@ -41,12 +41,14 @@ COMMAND_CODE show_equipment(player_type *owner_ptr, int target_item, BIT_FLAGS m for (k = 0, i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) { o_ptr = &owner_ptr->inventory_list[i]; if (!(owner_ptr->select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval) || (mode & USE_FULL)) - && (!((((i == INVEN_MAIN_HAND) && has_left_hand_weapon(owner_ptr)) || ((i == INVEN_SUB_HAND) && has_right_hand_weapon(owner_ptr))) && has_two_handed_weapons(owner_ptr)) + && (!((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr))) + && has_two_handed_weapons(owner_ptr)) || (mode & IGNORE_BOTHHAND_SLOT))) continue; describe_flavor(owner_ptr, o_name, o_ptr, 0); - if ((((i == INVEN_MAIN_HAND) && has_left_hand_weapon(owner_ptr)) || ((i == INVEN_SUB_HAND) && has_right_hand_weapon(owner_ptr))) && has_two_handed_weapons(owner_ptr)) { + if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr))) + && has_two_handed_weapons(owner_ptr)) { (void)strcpy(out_desc[k], _("(武器を両手持ち)", "(wielding with two-hands)")); out_color[k] = TERM_WHITE; } else {