From: Deskull Date: Tue, 22 Jan 2019 12:05:19 +0000 (+0900) Subject: [Refactor] #37353 buki_motteruka() を has_melee_weapon() に改名。 / Rename buki_motteruka... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=1d09c8f91943227995f18b1601e99a66bdcd630b [Refactor] #37353 buki_motteruka() を has_melee_weapon() に改名。 / Rename buki_motteruka() to has_melee_weapon(). --- diff --git a/src/cmd-item.c b/src/cmd-item.c index ba23f650a..fc9baba8b 100644 --- a/src/cmd-item.c +++ b/src/cmd-item.c @@ -183,7 +183,7 @@ void do_cmd_wield(void) case TV_SHIELD: case TV_CARD: /* Dual wielding */ - if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM)) { /* Restrict the choices */ item_tester_hook = item_tester_hook_melee_weapon; @@ -195,7 +195,7 @@ void do_cmd_wield(void) if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM; } - else if (buki_motteruka(INVEN_LARM)) slot = INVEN_RARM; + else if (has_melee_weapon(INVEN_LARM)) slot = INVEN_RARM; /* Both arms are already used by non-weapon */ else if (inventory[INVEN_RARM].k_idx && !object_is_melee_weapon(&inventory[INVEN_RARM]) && @@ -222,7 +222,7 @@ void do_cmd_wield(void) if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM; } - else if (!inventory[INVEN_RARM].k_idx && buki_motteruka(INVEN_LARM)) + else if (!inventory[INVEN_RARM].k_idx && has_melee_weapon(INVEN_LARM)) { if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM; } @@ -238,7 +238,7 @@ void do_cmd_wield(void) s = _("おっと。", "Oops."); if (!choose_object(&slot, q, s, (USE_EQUIP))) return; - if ((slot == INVEN_LARM) && !buki_motteruka(INVEN_RARM)) + if ((slot == INVEN_LARM) && !has_melee_weapon(INVEN_RARM)) need_switch_wielding = INVEN_RARM; } break; @@ -465,7 +465,7 @@ void kamaenaoshi(INVENTORY_IDX item) if (item == INVEN_RARM) { - if (buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_LARM)) { o_ptr = &inventory[INVEN_LARM]; object_desc(o_name, o_ptr, 0); @@ -495,7 +495,7 @@ void kamaenaoshi(INVENTORY_IDX item) o_ptr = &inventory[INVEN_RARM]; if (o_ptr->k_idx) object_desc(o_name, o_ptr, 0); - if (buki_motteruka(INVEN_RARM)) + if (has_melee_weapon(INVEN_RARM)) { if (object_allow_two_hands_wielding(o_ptr) && CAN_TWO_HANDS_WIELDING()) msg_format(_("%sを両手で構えた。", "You are wielding %s with both hands."), o_name); diff --git a/src/cmd-pet.c b/src/cmd-pet.c index dee6ab140..82dbc771f 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -674,7 +674,7 @@ void do_cmd_pet(void) powers[num++] = PET_RYOUTE; } - else if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + else if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) { if (p_ptr->pet_extra_flags & PF_RYOUTE) { diff --git a/src/cmd-read.c b/src/cmd-read.c index 4ae2058f6..911fbd6fd 100644 --- a/src/cmd-read.c +++ b/src/cmd-read.c @@ -107,12 +107,12 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known) case SV_SCROLL_CURSE_WEAPON: { k = 0; - if (buki_motteruka(INVEN_RARM)) + if (has_melee_weapon(INVEN_RARM)) { k = INVEN_RARM; - if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM; + if (has_melee_weapon(INVEN_LARM) && one_in_(2)) k = INVEN_LARM; } - else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM; + else if (has_melee_weapon(INVEN_LARM)) k = INVEN_LARM; if (k && curse_weapon(FALSE, k)) ident = TRUE; break; } diff --git a/src/cmd2.c b/src/cmd2.c index 9d54de2e9..cba6e7fa5 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -2332,7 +2332,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) } else if (boomerang) { - if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM)) { item_tester_hook = item_tester_hook_boomerang; q = _("どの武器を投げますか? ", "Throw which item? "); @@ -2344,7 +2344,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken) return FALSE; } } - else if (buki_motteruka(INVEN_LARM)) + else if (has_melee_weapon(INVEN_LARM)) { item = INVEN_LARM; o_ptr = &inventory[item]; diff --git a/src/dungeon.c b/src/dungeon.c index 87d4a8efe..389492c38 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2596,18 +2596,18 @@ static void process_world_aux_mutation(void) take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転倒", "tripping"), -1); msg_print(NULL); - if (buki_motteruka(INVEN_RARM)) + if (has_melee_weapon(INVEN_RARM)) { slot = INVEN_RARM; o_ptr = &inventory[INVEN_RARM]; - if (buki_motteruka(INVEN_LARM) && one_in_(2)) + if (has_melee_weapon(INVEN_LARM) && one_in_(2)) { o_ptr = &inventory[INVEN_LARM]; slot = INVEN_LARM; } } - else if (buki_motteruka(INVEN_LARM)) + else if (has_melee_weapon(INVEN_LARM)) { o_ptr = &inventory[INVEN_LARM]; slot = INVEN_LARM; diff --git a/src/effects.c b/src/effects.c index c379696d0..23ac4f40c 100644 --- a/src/effects.c +++ b/src/effects.c @@ -4505,7 +4505,7 @@ void calc_android_exp(void) if (value > 100000L) exp += (value - 100000L) / 4 * level; } - if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (buki_motteruka(i))) || (i == INVEN_BOW)) total_exp += exp / 48; + if ((((i == INVEN_RARM) || (i == INVEN_LARM)) && (has_melee_weapon(i))) || (i == INVEN_BOW)) total_exp += exp / 48; else total_exp += exp / 16; if (i == INVEN_BODY) total_exp += exp / 32; } @@ -4720,7 +4720,7 @@ bool choose_ele_attack(void) char choice; - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) { msg_format(_("武器を持たないと魔法剣は使えない。", "You cannot use temporary branding with no weapon.")); return FALSE; diff --git a/src/files.c b/src/files.c index 3662dd33f..92681678c 100644 --- a/src/files.c +++ b/src/files.c @@ -1695,7 +1695,7 @@ static void display_player_melee_bonus(int hand, int hand_entry) sprintf(buf, "(%+d,%+d)", (int)show_tohit, (int)show_todam); /* Dump the bonuses to hit/dam */ - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) display_player_one_line(ENTRY_BARE_HAND, buf, TERM_L_BLUE); else if (p_ptr->ryoute) display_player_one_line(ENTRY_TWO_HANDS, buf, TERM_L_BLUE); diff --git a/src/hissatsu.c b/src/hissatsu.c index 8559eb1c4..ca0d6f423 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -319,7 +319,7 @@ void do_cmd_hissatsu(void) msg_print(_("混乱していて集中できない!", "You are too confused!")); return; } - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) { if (flush_failure) flush(); msg_print(_("武器を持たないと必殺技は使えない!", "You need to wield a weapon!")); diff --git a/src/melee1.c b/src/melee1.c index 29a055a12..70bac3ff1 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -466,7 +466,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b { case CLASS_ROGUE: case CLASS_NINJA: - if (buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand]) + if (has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand]) { int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4; if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3; @@ -937,7 +937,7 @@ static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b } else k = 1; } - else if ((p_ptr->pclass == CLASS_NINJA) && buki_motteruka(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7))) + else if ((p_ptr->pclass == CLASS_NINJA) && has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7))) { int maxhp = maxroll(r_ptr->hdice, r_ptr->hside); if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27)) diff --git a/src/mind.c b/src/mind.c index 2a4b27ce9..6aa219b3a 100644 --- a/src/mind.c +++ b/src/mind.c @@ -856,8 +856,8 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse) put_str(format(_("Lv %s 失率 効果", "Lv %s Fail Info"), ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35); - has_weapon[0] = buki_motteruka(INVEN_RARM); - has_weapon[1] = buki_motteruka(INVEN_LARM); + has_weapon[0] = has_melee_weapon(INVEN_RARM); + has_weapon[1] = has_melee_weapon(INVEN_LARM); /* Dump the spells */ for (i = 0; i < MAX_MIND_POWERS; i++) @@ -1830,9 +1830,9 @@ void do_cmd_mind(void) { if (heavy_armor()) chance += 20; if (p_ptr->icky_wield[0]) chance += 20; - else if (buki_motteruka(INVEN_RARM)) chance += 10; + else if (has_melee_weapon(INVEN_RARM)) chance += 10; if (p_ptr->icky_wield[1]) chance += 20; - else if (buki_motteruka(INVEN_LARM)) chance += 10; + else if (has_melee_weapon(INVEN_LARM)) chance += 10; if (n == 5) { int j; diff --git a/src/mspells4.c b/src/mspells4.c index f2588f397..a3ee73992 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -4155,8 +4155,8 @@ HIT_POINT monspell_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, int TYPE) int shoot_dd = 1, shoot_ds = 1, shoot_base = 0; object_type *o_ptr = NULL; - if (buki_motteruka(INVEN_RARM)) o_ptr = &inventory[INVEN_RARM]; - else if (buki_motteruka(INVEN_LARM)) o_ptr = &inventory[INVEN_LARM]; + if (has_melee_weapon(INVEN_RARM)) o_ptr = &inventory[INVEN_RARM]; + else if (has_melee_weapon(INVEN_LARM)) o_ptr = &inventory[INVEN_LARM]; if (o_ptr) { diff --git a/src/object2.c b/src/object2.c index fb41dcbb2..eb3c238e8 100644 --- a/src/object2.c +++ b/src/object2.c @@ -5657,7 +5657,7 @@ void inven_item_increase(INVENTORY_IDX item, ITEM_NUMBER num) { if ((item == INVEN_RARM) || (item == INVEN_LARM)) { - if (!buki_motteruka(INVEN_RARM + INVEN_LARM - item)) + if (!has_melee_weapon(INVEN_RARM + INVEN_LARM - item)) { /* Clear all temporary elemental brands */ set_ele_attack(0, 0); diff --git a/src/patron.c b/src/patron.c index 6e26febea..2a9f15a20 100644 --- a/src/patron.c +++ b/src/patron.c @@ -615,15 +615,15 @@ void gain_level_reward(int chosen_reward) case REW_CURSE_WP: - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break; + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) break; msg_format(_("%sの声が響き渡った:", "The voice of %s booms out:"), chaos_patrons[p_ptr->chaos_patron]); msg_print(_("「汝、武器に頼ることなかれ。」", "'Thou reliest too much on thy weapon.'")); dummy = INVEN_RARM; - if (buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_LARM)) { dummy = INVEN_LARM; - if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM; + if (has_melee_weapon(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM; } object_desc(o_name, &inventory[dummy], OD_NAME_ONLY); (void)curse_weapon(FALSE, dummy); @@ -658,12 +658,12 @@ void gain_level_reward(int chosen_reward) case 3: if (one_in_(2)) { - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) break; + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) break; dummy = INVEN_RARM; - if (buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_LARM)) { dummy = INVEN_LARM; - if (buki_motteruka(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM; + if (has_melee_weapon(INVEN_RARM) && one_in_(2)) dummy = INVEN_RARM; } object_desc(o_name, &inventory[dummy], OD_NAME_ONLY); (void)curse_weapon(FALSE, dummy); @@ -703,12 +703,12 @@ void gain_level_reward(int chosen_reward) { dummy = 0; - if (buki_motteruka(INVEN_RARM)) + if (has_melee_weapon(INVEN_RARM)) { dummy = INVEN_RARM; - if (buki_motteruka(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM; + if (has_melee_weapon(INVEN_LARM) && one_in_(2)) dummy = INVEN_LARM; } - else if (buki_motteruka(INVEN_LARM)) dummy = INVEN_LARM; + else if (has_melee_weapon(INVEN_LARM)) dummy = INVEN_LARM; if (dummy) (void)curse_weapon(FALSE, dummy); } diff --git a/src/player-status.c b/src/player-status.c index e21d630ed..3ec8a2828 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -282,8 +282,8 @@ void calc_bonuses(void) /* Base skill -- digging */ p_ptr->skill_dig = 0; - if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE; - if (buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_RARM)) p_ptr->migite = TRUE; + if (has_melee_weapon(INVEN_LARM)) { p_ptr->hidarite = TRUE; if (!p_ptr->migite) default_hand = 1; @@ -1227,8 +1227,8 @@ void calc_bonuses(void) } /* Hack -- do not apply "weapon" bonuses */ - if (i == INVEN_RARM && buki_motteruka(i)) continue; - if (i == INVEN_LARM && buki_motteruka(i)) continue; + if (i == INVEN_RARM && has_melee_weapon(i)) continue; + if (i == INVEN_LARM && has_melee_weapon(i)) continue; /* Hack -- do not apply "bow" bonuses */ if (i == INVEN_BOW) continue; @@ -1744,7 +1744,7 @@ void calc_bonuses(void) p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200; } - if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM)) + if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM)) { int penalty1, penalty2; penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8); @@ -1924,7 +1924,7 @@ void calc_bonuses(void) p_ptr->icky_wield[i] = FALSE; p_ptr->riding_wield[i] = FALSE; - if (!buki_motteruka(INVEN_RARM + i)) + if (!has_melee_weapon(INVEN_RARM + i)) { p_ptr->num_blow[i] = 1; continue; @@ -2215,7 +2215,7 @@ void calc_bonuses(void) case CLASS_MONK: case CLASS_FORCETRAINER: case CLASS_BERSERKER: - if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) p_ptr->riding_ryoute = TRUE; break; } @@ -2331,7 +2331,7 @@ void calc_bonuses(void) for (i = 0; i < 2; i++) { - if (buki_motteruka(INVEN_RARM + i)) + if (has_melee_weapon(INVEN_RARM + i)) { OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM + i].tval - TV_WEAPON_BEGIN; OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM + i].sval; @@ -2552,7 +2552,7 @@ void calc_bonuses(void) { msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon.")); } - else if (buki_motteruka(INVEN_RARM + i)) + else if (has_melee_weapon(INVEN_RARM + i)) { msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon.")); } @@ -2580,7 +2580,7 @@ void calc_bonuses(void) { msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding.")); } - else if (buki_motteruka(INVEN_RARM + i)) + else if (has_melee_weapon(INVEN_RARM + i)) { msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding.")); } @@ -2599,7 +2599,7 @@ void calc_bonuses(void) chg_virtue(V_FAITH, -1); } } - else if (buki_motteruka(INVEN_RARM + i)) + else if (has_melee_weapon(INVEN_RARM + i)) { msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon.")); } @@ -3634,7 +3634,7 @@ WEIGHT weight_limit(void) * @param i 判定する手のID(右手:0 左手:1) * @return 持っているならばTRUE */ -bool buki_motteruka(int i) +bool has_melee_weapon(int i) { return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE); } diff --git a/src/player-status.h b/src/player-status.h index b0706930f..cbd9e863a 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -6,7 +6,7 @@ extern int spell_exp_level(int spell_exp); extern s16b calc_num_fire(object_type *o_ptr); extern void calc_bonuses(void); extern WEIGHT weight_limit(void); -extern bool buki_motteruka(int i); +extern bool has_melee_weapon(int i); extern bool is_heavy_shoot(object_type *o_ptr); extern bool heavy_armor(void); extern void update_creature(player_type *creature_ptr); diff --git a/src/racial.c b/src/racial.c index f49fff810..df59f850f 100644 --- a/src/racial.c +++ b/src/racial.c @@ -993,7 +993,7 @@ static bool cmd_racial_power_aux(s32b command) } else if (command == -4) { - if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM)) + if (!has_melee_weapon(INVEN_RARM) && !has_melee_weapon(INVEN_LARM)) { msg_print(_("武器を持たないといけません。", "You need to wield a weapon.")); return FALSE; diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 2774b266d..b1c63073e 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -583,7 +583,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) { int damage; - if (!buki_motteruka(INVEN_RARM + i)) break; + if (!has_melee_weapon(INVEN_RARM + i)) break; o_ptr = &inventory[INVEN_RARM + i]; basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50; damage = o_ptr->to_d * 100; @@ -863,7 +863,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) for (i = 0; i < 2; i++) { int damage; - if (!buki_motteruka(INVEN_RARM + i)) break; + if (!has_melee_weapon(INVEN_RARM + i)) break; o_ptr = &inventory[INVEN_RARM + i]; basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50; damage = o_ptr->to_d * 100;