#include "player/player-status-flags.h"
-#include "art-definition/art-sword-types.h"
+#include "artifact/fixed-art-types.h"
#include "grid/grid.h"
#include "inventory/inventory-slot-types.h"
#include "monster-race/monster-race.h"
#include "object-hook/hook-checker.h"
#include "object-hook/hook-weapon.h"
#include "object/object-flags.h"
+#include "player/mimic-info-table.h"
#include "player/player-class.h"
#include "player/player-race-types.h"
#include "player/player-race.h"
#include "player/player-skill.h"
#include "player/player-status.h"
+#include "player/race-info-table.h"
#include "player/special-defense-types.h"
#include "realm/realm-hex-numbers.h"
#include "realm/realm-song-numbers.h"
static BIT_FLAGS check_equipment_flags(player_type *creature_ptr, tr_type tr_flag);
+/*!
+ * @brief 装備による所定の特性フラグを得ているかを一括して取得する関数。
+ */
static BIT_FLAGS check_equipment_flags(player_type *creature_ptr, tr_type tr_flag)
{
object_type *o_ptr;
return result;
}
-bool is_kill_wall(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが壁破壊進行を持っているかを返す。
+ */
+bool has_kill_wall(player_type *creature_ptr)
{
if (creature_ptr->mimic_form == MIMIC_DEMON_LORD || music_singing(creature_ptr, MUSIC_WALL)) {
return TRUE;
return FALSE;
}
-bool is_pass_wall(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが壁通過を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたらTRUE
+ * @details
+ * * 時限で幽体化、壁抜けをもつか種族幽霊ならばひとまずTRUE。
+ * * 但し騎乗中は乗騎が壁抜けを持っていなければ不能になる。
+ */
+bool has_pass_wall(player_type *creature_ptr)
{
bool pow = FALSE;
return pow;
}
-BIT_FLAGS is_xtra_might(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが強力射を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_xtra_might(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
result |= check_equipment_flags(creature_ptr, TR_XTRA_MIGHT);
return result;
}
-BIT_FLAGS is_esp_evil(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが赤外線視力修正を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ * @details 種族修正は0より大きければTRUEとする。
+ */
+BIT_FLAGS has_infra_vision(player_type *creature_ptr)
+{
+ BIT_FLAGS result = 0L;
+ const player_race *tmp_rp_ptr;
+
+ if (creature_ptr->mimic_form)
+ tmp_rp_ptr = &mimic_info[creature_ptr->mimic_form];
+ else
+ tmp_rp_ptr = &race_info[creature_ptr->prace];
+
+ if (tmp_rp_ptr->infra > 0)
+ result |= FLAG_CAUSE_RACE;
+
+ if (creature_ptr->muta3 & MUT3_INFRAVIS)
+ result |= FLAG_CAUSE_MUTATION;
+
+ if (creature_ptr->tim_infra)
+ result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
+
+ result |= check_equipment_flags(creature_ptr, TR_INFRA);
+ return result;
+}
+
+
+/*!
+ * @brief クリーチャーが邪悪感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_evil(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->realm1 == REALM_HEX) {
return result;
}
-BIT_FLAGS is_esp_animal(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが自然界の動物感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_animal(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_ANIMAL);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_ANIMAL);
}
-BIT_FLAGS is_esp_undead(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがアンデッド感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_undead(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_UNDEAD);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_UNDEAD);
}
-BIT_FLAGS is_esp_demon(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが悪魔感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_demon(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_DEMON);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_DEMON);
}
-BIT_FLAGS is_esp_orc(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがオーク感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_orc(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_ORC);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_ORC);
}
-BIT_FLAGS is_esp_troll(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがトロル感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_troll(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_TROLL);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_TROLL);
}
-BIT_FLAGS is_esp_giant(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが巨人感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_giant(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_GIANT);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_GIANT);
}
-BIT_FLAGS is_esp_dragon(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがドラゴン感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_dragon(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_DRAGON);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_DRAGON);
}
-BIT_FLAGS is_esp_human(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが人間感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_human(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_HUMAN);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_HUMAN);
}
-BIT_FLAGS is_esp_good(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが善良感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_good(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_GOOD);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_GOOD);
}
-BIT_FLAGS is_esp_nonliving(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーが無生物感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_nonliving(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_GOOD);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_GOOD);
}
-BIT_FLAGS is_esp_unique(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがユニーク感知を持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_unique(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_ESP_UNIQUE);
- return result;
+ return check_equipment_flags(creature_ptr, TR_ESP_UNIQUE);
}
-BIT_FLAGS is_esp_telepathy(player_type *creature_ptr)
+/*!
+ * @brief クリーチャーがテレパシーを持っているかを返す。
+ * @param creature_ptr 判定対象のクリーチャー参照ポインタ
+ * @return 持っていたら所持前提ビットフラグを返す。
+ */
+BIT_FLAGS has_esp_telepathy(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
BIT_FLAGS has_bless_blade(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_BLESSED);
- return result;
+ return check_equipment_flags(creature_ptr, TR_BLESSED);
}
BIT_FLAGS has_easy2_weapon(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_EASY2_WEAPON);
- return result;
+ return check_equipment_flags(creature_ptr, TR_EASY2_WEAPON);
}
BIT_FLAGS has_down_saving(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_DOWN_SAVING);
- return result;
+ return check_equipment_flags(creature_ptr, TR_DOWN_SAVING);
}
BIT_FLAGS has_no_ac(player_type *creature_ptr)
{
+ return check_equipment_flags(creature_ptr, TR_NO_AC);
+}
+
+BIT_FLAGS has_invuln_arrow(player_type *creature_ptr)
+{
BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_NO_AC);
+ if (creature_ptr->blind)
+ return result;
+ result |= check_equipment_flags(creature_ptr, TR_INVULN_ARROW);
return result;
}
creature_ptr->no_flowed = FALSE;
- if (creature_ptr->pass_wall && !creature_ptr->kill_wall)
+ if (has_pass_wall(creature_ptr) && !has_kill_wall(creature_ptr))
creature_ptr->no_flowed = TRUE;
for (int i = 0; i < INVEN_PACK; i++) {
BIT_FLAGS has_mighty_throw(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_MIGHTY_THROW);
- return result;
+ return check_equipment_flags(creature_ptr, TR_MIGHTY_THROW);
}
BIT_FLAGS has_dec_mana(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_DEC_MANA);
- return result;
+ return check_equipment_flags(creature_ptr, TR_DEC_MANA);
}
+
BIT_FLAGS has_reflect(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
BIT_FLAGS has_anti_magic(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_NO_MAGIC);
- return result;
+ return check_equipment_flags(creature_ptr, TR_NO_MAGIC);
}
BIT_FLAGS has_anti_tele(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_NO_TELE);
- return result;
+ return check_equipment_flags(creature_ptr, TR_NO_TELE);
}
BIT_FLAGS has_sh_fire(player_type *creature_ptr)
BIT_FLAGS has_easy_spell(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_EASY_SPELL);
- return result;
+ return check_equipment_flags(creature_ptr, TR_EASY_SPELL);
}
BIT_FLAGS has_heavy_spell(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_HEAVY_SPELL);
- return result;
+ return check_equipment_flags(creature_ptr, TR_HEAVY_SPELL);
}
BIT_FLAGS has_hold_exp(player_type *creature_ptr)
return result;
}
+BIT_FLAGS has_magic_mastery(player_type *creature_ptr)
+{
+ return check_equipment_flags(creature_ptr, TR_MAGIC_MASTERY);
+}
+
BIT_FLAGS has_free_act(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_sustain_str(player_type *creature_ptr)
+BIT_FLAGS has_sustain_str(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_sustain_int(player_type *creature_ptr)
+BIT_FLAGS has_sustain_int(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_sustain_wis(player_type *creature_ptr)
+BIT_FLAGS has_sustain_wis(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_sustain_dex(player_type *creature_ptr)
+BIT_FLAGS has_sustain_dex(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->pclass == CLASS_BERSERKER) {
return result;
}
-BIT_FLAGS is_sustain_con(player_type *creature_ptr)
+BIT_FLAGS has_sustain_con(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->pclass == CLASS_BERSERKER) {
return result;
}
-BIT_FLAGS is_sustain_chr(player_type *creature_ptr)
+BIT_FLAGS has_sustain_chr(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
BIT_FLAGS has_impact(player_type *creature_ptr)
{
- BIT_FLAGS result = 0L;
- result |= check_equipment_flags(creature_ptr, TR_IMPACT);
- return result;
+ return check_equipment_flags(creature_ptr, TR_IMPACT);
}
void has_extra_blow(player_type *creature_ptr)
}
}
-BIT_FLAGS is_resist_acid(player_type *creature_ptr)
+BIT_FLAGS has_resist_acid(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
result |= 0x01 << FLAG_CAUSE_MAGIC_TIME_EFFECT;
}
- result |= is_immune_acid(creature_ptr);
+ result |= has_immune_acid(creature_ptr);
result |= check_equipment_flags(creature_ptr, TR_RES_ACID);
return result;
}
-BIT_FLAGS is_vuln_acid(player_type *creature_ptr)
+BIT_FLAGS has_vuln_acid(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->muta3 & MUT3_VULN_ELEM) {
return result;
}
-BIT_FLAGS is_resist_elec(player_type *creature_ptr)
+BIT_FLAGS has_resist_elec(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
}
result |= check_equipment_flags(creature_ptr, TR_RES_ELEC);
- result |= is_immune_elec(creature_ptr);
+ result |= has_immune_elec(creature_ptr);
return result;
}
-BIT_FLAGS is_vuln_elec(player_type *creature_ptr)
+BIT_FLAGS has_vuln_elec(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->muta3 & MUT3_VULN_ELEM) {
return result;
}
-BIT_FLAGS is_resist_fire(player_type *creature_ptr)
+BIT_FLAGS has_resist_fire(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
}
result |= check_equipment_flags(creature_ptr, TR_RES_FIRE);
- result |= is_immune_fire(creature_ptr);
+ result |= has_immune_fire(creature_ptr);
return result;
}
-BIT_FLAGS is_vuln_fire(player_type *creature_ptr)
+BIT_FLAGS has_vuln_fire(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->muta3 & MUT3_VULN_ELEM) {
return result;
}
-BIT_FLAGS is_resist_cold(player_type *creature_ptr)
+BIT_FLAGS has_resist_cold(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
}
result |= check_equipment_flags(creature_ptr, TR_RES_COLD);
- result |= is_immune_cold(creature_ptr);
+ result |= has_immune_cold(creature_ptr);
return result;
}
-BIT_FLAGS is_vuln_cold(player_type *creature_ptr)
+BIT_FLAGS has_vuln_cold(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (creature_ptr->muta3 & MUT3_VULN_ELEM) {
return result;
}
-BIT_FLAGS is_resist_pois(player_type *creature_ptr)
+BIT_FLAGS has_resist_pois(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_conf(player_type *creature_ptr)
+BIT_FLAGS has_resist_conf(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_sound(player_type *creature_ptr)
+BIT_FLAGS has_resist_sound(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_lite(player_type *creature_ptr)
+BIT_FLAGS has_resist_lite(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_vuln_lite(player_type *creature_ptr)
+BIT_FLAGS has_vuln_lite(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (is_specific_player_race(creature_ptr, RACE_S_FAIRY) || is_specific_player_race(creature_ptr, RACE_VAMPIRE)
return result;
}
-BIT_FLAGS is_resist_dark(player_type *creature_ptr)
+BIT_FLAGS has_resist_dark(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_chaos(player_type *creature_ptr)
+BIT_FLAGS has_resist_chaos(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_disen(player_type *creature_ptr)
+BIT_FLAGS has_resist_disen(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_shard(player_type *creature_ptr)
+BIT_FLAGS has_resist_shard(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_nexus(player_type *creature_ptr)
+BIT_FLAGS has_resist_nexus(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_blind(player_type *creature_ptr)
+BIT_FLAGS has_resist_blind(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_neth(player_type *creature_ptr)
+BIT_FLAGS has_resist_neth(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_time(player_type *creature_ptr)
+BIT_FLAGS has_resist_time(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_water(player_type *creature_ptr)
+BIT_FLAGS has_resist_water(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_resist_fear(player_type *creature_ptr)
+BIT_FLAGS has_resist_fear(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_immune_acid(player_type *creature_ptr)
+BIT_FLAGS has_immune_acid(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_YEEK && creature_ptr->lev > 19)
return result;
}
-BIT_FLAGS is_immune_elec(player_type *creature_ptr)
+BIT_FLAGS has_immune_elec(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_immune_fire(player_type *creature_ptr)
+BIT_FLAGS has_immune_fire(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_immune_cold(player_type *creature_ptr)
+BIT_FLAGS has_immune_cold(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
-BIT_FLAGS is_immune_dark(player_type *creature_ptr)
+BIT_FLAGS has_immune_dark(player_type *creature_ptr)
{
BIT_FLAGS result = 0L;
return result;
}
+/*
+ * @brief 右手(利き手)が武器を持っているかどうかを判定する
+ * @detail Includes martial arts and hand combats as weapons.
+ */
bool has_right_hand_weapon(player_type *creature_ptr)
{
if (has_melee_weapon(creature_ptr, INVEN_RARM))
return TRUE;
- if (can_two_hands_wielding(creature_ptr)) {
- switch (creature_ptr->pclass) {
- case CLASS_MONK:
- case CLASS_FORCETRAINER:
- case CLASS_BERSERKER:
- if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) {
- return TRUE;
- }
- break;
- }
- }
+ if ((empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM) && !has_left_hand_weapon(creature_ptr))
+ return TRUE;
return FALSE;
}
+/*
+ * @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_LARM); }
bool has_two_handed_weapons(player_type *creature_ptr)
return result;
}
-bool is_disable_two_handed_bonus(player_type *creature_ptr, int i)
+/*
+ * @brief 両手持ちボーナスがもらえないかどうかを判定する。 / Does *not * get two hand wielding bonus.
+ * @detail
+ * Only can get hit bonuses when wieids an enough light weapon which is lighter than 5 times of weight limit.
+ * If its weight is 10 times heavier or more than weight limit, gets hit penalty in calc_to_hit().
+ */
+bool has_disable_two_handed_bonus(player_type *creature_ptr, int i)
{
- object_type *o_ptr;
- o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
- if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
- if (calc_weapon_weight_limit(creature_ptr) * 2 >= o_ptr->weight / 10 && has_two_handed_weapons(creature_ptr)
- && (calc_weapon_weight_limit(creature_ptr) * 2 < o_ptr->weight / 5))
- return TRUE;
+ if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && has_two_handed_weapons(creature_ptr)) {
+ object_type *o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
+ int limit = calc_weapon_weight_limit(creature_ptr) * 2;
+
+ /* Enable when two hand wields an enough light weapon */
+ if (limit >= o_ptr->weight / 5)
+ return FALSE;
}
- return FALSE;
+
+ /* Disable when empty hands, one hand wieldings and heavy weapons */
+ return TRUE;
}
-bool is_icky_wield_weapon(player_type *creature_ptr, int i)
+bool has_icky_wield_weapon(player_type *creature_ptr, int i)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
return TRUE;
}
}
- if (is_not_monk_weapon(creature_ptr, i) || is_not_ninja_weapon(creature_ptr, i)) {
+ if (has_not_monk_weapon(creature_ptr, i) || has_not_ninja_weapon(creature_ptr, i)) {
return TRUE;
}
return FALSE;
}
-bool is_riding_wield_weapon(player_type *creature_ptr, int i)
+bool has_riding_wield_weapon(player_type *creature_ptr, int i)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
return FALSE;
}
-bool is_not_ninja_weapon(player_type *creature_ptr, int i)
+bool has_not_ninja_weapon(player_type *creature_ptr, int i)
{
tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
&& !((s_info[CLASS_NINJA].w_max[tval][sval] > WEAPON_EXP_BEGINNER) && (creature_ptr->inventory_list[INVEN_LARM - i].tval != TV_SHIELD));
}
-bool is_not_monk_weapon(player_type *creature_ptr, int i)
+bool has_not_monk_weapon(player_type *creature_ptr, int i)
{
tval_type tval = creature_ptr->inventory_list[INVEN_RARM + i].tval - TV_WEAPON_BEGIN;
OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
- return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
+ return ((creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER))
+ && !(s_info[creature_ptr->pclass].w_max[tval][sval]);
}
bool has_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 & MUT3_GOOD_LUCK); }