static s16b calc_charisma_addition(player_type *creature_ptr);
static s16b calc_to_magic_chance(player_type *creature_ptr);
static ARMOUR_CLASS calc_base_ac(player_type *creature_ptr);
-static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value);
+static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_real_value);
static s16b calc_speed(player_type *creature_ptr);
static s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot);
static void calc_use_status(player_type *creature_ptr, int status);
static s16b calc_riding_bow_penalty(player_type *creature_ptr);
static void put_equipment_warning(player_type *creature_ptr);
-static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
-static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value);
+static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
+static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value);
-static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value);
+static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_real_value);
static s16b calc_to_damage_misc(player_type *creature_ptr);
static s16b calc_to_hit_misc(player_type *creature_ptr);
static DICE_NUMBER calc_to_weapon_dice_num(player_type *creature_ptr, INVENTORY_IDX slot);
static DICE_NUMBER calc_to_weapon_dice_side(player_type *creature_ptr, INVENTORY_IDX slot);
-static int get_default_hand(player_type *creature_ptr);
+static player_hand main_attack_hand(player_type *creature_ptr);
/*** Player information ***/
ARMOUR_CLASS old_dis_ac = creature_ptr->dis_ac;
ARMOUR_CLASS old_dis_to_a = creature_ptr->dis_to_a;
- creature_ptr->pass_wall = has_pass_wall(creature_ptr);
- creature_ptr->kill_wall = has_kill_wall(creature_ptr);
creature_ptr->xtra_might = has_xtra_might(creature_ptr);
creature_ptr->esp_evil = has_esp_evil(creature_ptr);
creature_ptr->esp_animal = has_esp_animal(creature_ptr);
creature_ptr->hold_exp = has_hold_exp(creature_ptr);
creature_ptr->see_inv = has_see_inv(creature_ptr);
creature_ptr->free_act = has_free_act(creature_ptr);
- creature_ptr->sustain_wis = has_sustain_wis(creature_ptr);
- creature_ptr->sustain_dex = has_sustain_dex(creature_ptr);
- creature_ptr->sustain_con = has_sustain_con(creature_ptr);
- creature_ptr->sustain_chr = has_sustain_chr(creature_ptr);
creature_ptr->levitation = has_levitation(creature_ptr);
has_can_swim(creature_ptr);
creature_ptr->slow_digest = has_slow_digest(creature_ptr);
creature_ptr->lite = has_lite(creature_ptr);
if (creature_ptr->special_defense & KAMAE_MASK) {
- if (!(empty_hands_status & EMPTY_HAND_RARM)) {
+ if (!(empty_hands_status & EMPTY_HAND_MAIN)) {
set_action(creature_ptr, ACTION_NONE);
}
}
creature_ptr->stat_add[A_DEX] = calc_dexterity_addition(creature_ptr);
creature_ptr->stat_add[A_CON] = calc_constitution_addition(creature_ptr);
creature_ptr->stat_add[A_CHR] = calc_charisma_addition(creature_ptr);
- creature_ptr->to_m_chance = calc_to_magic_chance(creature_ptr);
- creature_ptr->ac = calc_base_ac(creature_ptr);
- creature_ptr->to_a = calc_to_ac(creature_ptr, TRUE);
- creature_ptr->dis_ac = calc_base_ac(creature_ptr);
- creature_ptr->dis_to_a = calc_to_ac(creature_ptr, FALSE);
for (int i = 0; i < A_MAX; i++) {
calc_top_status(creature_ptr, i);
creature_ptr->icky_wield[i] = has_icky_wield_weapon(creature_ptr, i);
creature_ptr->riding_wield[i] = has_riding_wield_weapon(creature_ptr, i);
creature_ptr->num_blow[i] = calc_num_blow(creature_ptr, i);
- creature_ptr->to_dd[i] = calc_to_weapon_dice_num(creature_ptr, INVEN_RARM + i);
- creature_ptr->to_ds[i] = calc_to_weapon_dice_side(creature_ptr, INVEN_RARM + i);
+ creature_ptr->to_dd[i] = calc_to_weapon_dice_num(creature_ptr, INVEN_MAIN_HAND + i);
+ creature_ptr->to_ds[i] = calc_to_weapon_dice_side(creature_ptr, INVEN_MAIN_HAND + i);
}
creature_ptr->pspeed = calc_speed(creature_ptr);
creature_ptr->skill_thn = calc_to_hit_melee(creature_ptr);
creature_ptr->skill_thb = calc_to_hit_shoot(creature_ptr);
creature_ptr->skill_tht = calc_to_hit_throw(creature_ptr);
- creature_ptr->to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, TRUE);
- creature_ptr->to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, TRUE);
- creature_ptr->dis_to_d[0] = calc_to_damage(creature_ptr, INVEN_RARM, FALSE);
- creature_ptr->dis_to_d[1] = calc_to_damage(creature_ptr, INVEN_LARM, FALSE);
- creature_ptr->to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, TRUE);
- creature_ptr->to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, TRUE);
- creature_ptr->dis_to_h[0] = calc_to_hit(creature_ptr, INVEN_RARM, FALSE);
- creature_ptr->dis_to_h[1] = calc_to_hit(creature_ptr, INVEN_LARM, FALSE);
+ creature_ptr->to_d[0] = calc_to_damage(creature_ptr, INVEN_MAIN_HAND, TRUE);
+ creature_ptr->to_d[1] = calc_to_damage(creature_ptr, INVEN_SUB_HAND, TRUE);
+ creature_ptr->dis_to_d[0] = calc_to_damage(creature_ptr, INVEN_MAIN_HAND, FALSE);
+ creature_ptr->dis_to_d[1] = calc_to_damage(creature_ptr, INVEN_SUB_HAND, FALSE);
+ creature_ptr->to_h[0] = calc_to_hit(creature_ptr, INVEN_MAIN_HAND, TRUE);
+ creature_ptr->to_h[1] = calc_to_hit(creature_ptr, INVEN_SUB_HAND, TRUE);
+ creature_ptr->dis_to_h[0] = calc_to_hit(creature_ptr, INVEN_MAIN_HAND, FALSE);
+ creature_ptr->dis_to_h[1] = calc_to_hit(creature_ptr, INVEN_SUB_HAND, FALSE);
creature_ptr->to_h_b = calc_to_hit_bow(creature_ptr, TRUE);
creature_ptr->dis_to_h_b = calc_to_hit_bow(creature_ptr, FALSE);
creature_ptr->to_d_m = calc_to_damage_misc(creature_ptr);
creature_ptr->to_h_m = calc_to_hit_misc(creature_ptr);
creature_ptr->skill_dig = calc_skill_dig(creature_ptr);
+ creature_ptr->to_m_chance = calc_to_magic_chance(creature_ptr);
+ creature_ptr->ac = calc_base_ac(creature_ptr);
+ creature_ptr->to_a = calc_to_ac(creature_ptr, TRUE);
+ creature_ptr->dis_ac = calc_base_ac(creature_ptr);
+ creature_ptr->dis_to_a = calc_to_ac(creature_ptr, FALSE);
if (old_mighty_throw != creature_ptr->mighty_throw) {
creature_ptr->window |= PW_INVEN;
return;
put_equipment_warning(creature_ptr);
+ check_no_flowed(creature_ptr);
}
static void calc_alignment(player_type *creature_ptr)
}
for (int i = 0; i < 2; i++) {
- if (!has_melee_weapon(creature_ptr, INVEN_RARM + i))
+ if (!has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i))
continue;
- if (creature_ptr->inventory_list[INVEN_RARM + i].name1 != ART_IRON_BALL)
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND + i].name1 != ART_IRON_BALL)
continue;
creature_ptr->align -= 1000;
}
*/
static void calc_mana(player_type *creature_ptr)
{
- if (!mp_ptr->spell_book)
+ if (!mp_ptr->spell_book && mp_ptr->spell_first == SPELL_FIRST_NO_SPELL)
return;
int levels;
BIT_FLAGS flgs[TR_FLAG_SIZE];
creature_ptr->cumber_glove = FALSE;
object_type *o_ptr;
- o_ptr = &creature_ptr->inventory_list[INVEN_HANDS];
+ o_ptr = &creature_ptr->inventory_list[INVEN_ARMS];
object_flags(creature_ptr, o_ptr, flgs);
if (o_ptr->k_idx && !(has_flag(flgs, TR_FREE_ACT)) && !(has_flag(flgs, TR_DEC_MANA)) && !(has_flag(flgs, TR_EASY_SPELL))
&& !((has_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) && !((has_flag(flgs, TR_DEX)) && (o_ptr->pval > 0))) {
creature_ptr->cumber_armor = FALSE;
int cur_wgt = 0;
- if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
- if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval > TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval > TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight;
cur_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
cur_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
cur_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
- cur_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
+ cur_wgt += creature_ptr->inventory_list[INVEN_ARMS].weight;
cur_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
switch (creature_ptr->pclass) {
case CLASS_MONK:
case CLASS_FORCETRAINER:
case CLASS_SORCERER: {
- if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
- if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight;
break;
}
case CLASS_PRIEST:
case CLASS_BARD:
case CLASS_TOURIST: {
- if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight * 2 / 3;
- if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight * 2 / 3;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight * 2 / 3;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight * 2 / 3;
break;
}
case CLASS_MINDCRAFTER:
case CLASS_BEASTMASTER:
case CLASS_MIRROR_MASTER: {
- if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 2;
- if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 2;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight / 2;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight / 2;
break;
}
case CLASS_ROGUE:
case CLASS_RANGER:
case CLASS_RED_MAGE:
case CLASS_WARRIOR_MAGE: {
- if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 3;
- if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 3;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight / 3;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight / 3;
break;
}
case CLASS_PALADIN:
case CLASS_CHAOS_WARRIOR: {
- if (creature_ptr->inventory_list[INVEN_RARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_RARM].weight / 5;
- if (creature_ptr->inventory_list[INVEN_LARM].tval <= TV_SWORD)
- cur_wgt += creature_ptr->inventory_list[INVEN_LARM].weight / 5;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight / 5;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval <= TV_SWORD)
+ cur_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight / 5;
break;
}
default: {
int extra_shots = 0;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *q_ptr;
q_ptr = &creature_ptr->inventory_list[i];
if (!q_ptr->k_idx)
pow += 3;
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
pow = 1 + tmp_rp_ptr->r_stl + c_ptr->c_stl + a_ptr->a_stl;
pow += (c_ptr->x_stl * creature_ptr->lev / 10);
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
if (hex_spelling_any(creature_ptr))
pow -= (1 + casting_hex_num(creature_ptr));
}
- if ((is_specific_player_race(creature_ptr, RACE_S_FAIRY)) && (creature_ptr->pseikaku != PERSONALITY_SEXY) && (creature_ptr->cursed & TRC_AGGRAVATE)) {
+ if (player_aggravate_state(creature_ptr) == AGGRAVATE_S_FAIRY) {
pow = MIN(pow - 3, (pow + 2) / 2);
}
pow -= 7;
}
- if (creature_ptr->pclass == CLASS_NINJA && heavy_armor(creature_ptr)) {
- pow -= (creature_ptr->lev) / 10;
- } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
- && (!creature_ptr->inventory_list[INVEN_LARM].k_idx || has_left_hand_weapon(creature_ptr))) {
- pow += (creature_ptr->lev) / 10;
+ 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 || 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;
+ }
}
if (is_time_limit_stealth(creature_ptr))
pow = tmp_rp_ptr->r_dev + c_ptr->c_dev + a_ptr->a_dev;
pow += ((c_ptr->x_dev * creature_ptr->lev / 10) + (ap_ptr->a_dev * creature_ptr->lev / 50));
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
pow = tmp_rp_ptr->r_srh + c_ptr->c_srh + a_ptr->a_srh;
pow += (c_ptr->x_srh * creature_ptr->lev / 10);
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
pow = tmp_rp_ptr->r_fos + c_ptr->c_fos + a_ptr->a_fos;
pow += (c_ptr->x_fos * creature_ptr->lev / 10);
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
pow = 0;
- if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT && !creature_ptr->inventory_list[INVEN_RARM].k_idx) {
+ if (!creature_ptr->mimic_form && creature_ptr->prace == RACE_ENT && !creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx) {
pow += creature_ptr->lev * 10;
}
if (creature_ptr->pclass == CLASS_BERSERKER)
pow += (100 + creature_ptr->lev * 8);
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
}
for (int i = 0; i < 2; i++) {
- o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
- if (has_melee_weapon(creature_ptr, INVEN_RARM + i) && !creature_ptr->heavy_wield[i]) {
+ o_ptr = &creature_ptr->inventory_list[INVEN_MAIN_HAND + i];
+ if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i) && !creature_ptr->heavy_wield[i]) {
pow += (o_ptr->weight / 10);
}
}
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_RARM) && !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)
{
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
- s16b num_blow = 0;
+ s16b num_blow = 1;
- o_ptr = &creature_ptr->inventory_list[INVEN_RARM + i];
+ o_ptr = &creature_ptr->inventory_list[INVEN_MAIN_HAND + i];
object_flags(creature_ptr, o_ptr, flgs);
creature_ptr->heavy_wield[i] = FALSE;
- if (!has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
- num_blow = 1;
- } else {
+ if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) {
if (calc_weapon_weight_limit(creature_ptr) < o_ptr->weight / 10) {
creature_ptr->heavy_wield[i] = TRUE;
}
num_blow++;
if (blow_base > 58)
num_blow++;
-
- MAGIC_NUM1 current_ki = get_current_ki(creature_ptr);
- if (current_ki != i) {
- creature_ptr->to_d[i] += current_ki / 5;
- creature_ptr->dis_to_d[i] += current_ki / 5;
- }
} else {
if (blow_base > 12)
num_blow++;
num_blow /= 2;
if (creature_ptr->special_defense & KAMAE_GENBU) {
- creature_ptr->to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
- creature_ptr->dis_to_a += (creature_ptr->lev * creature_ptr->lev) / 50;
num_blow -= 2;
if ((creature_ptr->pclass == CLASS_MONK) && (creature_ptr->lev > 42))
num_blow--;
if (num_blow < 0)
num_blow = 0;
} else if (creature_ptr->special_defense & KAMAE_SUZAKU) {
- creature_ptr->to_h[i] -= (creature_ptr->lev / 3);
- creature_ptr->to_d[i] -= (creature_ptr->lev / 6);
-
- creature_ptr->dis_to_h[i] -= (creature_ptr->lev / 3);
- creature_ptr->dis_to_d[i] -= (creature_ptr->lev / 6);
num_blow /= 2;
}
pow++;
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
}
if (creature_ptr->muta3) {
-
if (creature_ptr->muta3 & MUT3_HYPER_STR) {
pow += 4;
}
const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
pow = tmp_rp_ptr->r_adj[A_INT] + c_ptr->c_adj[A_INT] + a_ptr->a_adj[A_INT];
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
pow = tmp_rp_ptr->r_adj[A_WIS] + c_ptr->c_adj[A_WIS] + a_ptr->a_adj[A_WIS];
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
}
if (creature_ptr->muta3) {
-
if (creature_ptr->muta3 & MUT3_HYPER_INT) {
pow += 4;
}
pow--;
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
pow++;
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
const player_personality *a_ptr = &personality_info[creature_ptr->pseikaku];
pow = tmp_rp_ptr->r_adj[A_CHR] + c_ptr->c_adj[A_CHR] + a_ptr->a_adj[A_CHR];
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
if (creature_ptr->pseikaku == PERSONALITY_CHARGEMAN)
chance += 5;
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
BIT_FLAGS flgs[TR_FLAG_SIZE];
o_ptr = &creature_ptr->inventory_list[i];
if (creature_ptr->yoiyami)
return 0;
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
ac += o_ptr->ac;
}
- if (object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_RARM])
- || object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_LARM])) {
+ if (object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_MAIN_HAND])
+ || object_is_armour(creature_ptr, &creature_ptr->inventory_list[INVEN_SUB_HAND])) {
ac += creature_ptr->skill_exp[GINOU_SHIELD] * (1 + creature_ptr->lev / 22) / 2000;
}
return ac;
}
-static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_true_value)
+static ARMOUR_CLASS calc_to_ac(player_type *creature_ptr, bool is_real_value)
{
ARMOUR_CLASS ac = 0;
if (creature_ptr->yoiyami)
ac -= 50;
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr;
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
- if (is_true_value || object_is_known(o_ptr))
+ if (is_real_value || object_is_known(o_ptr))
ac += o_ptr->to_a;
if (o_ptr->curse_flags & TRC_LOW_AC) {
if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
- if (is_true_value || object_is_fully_known(o_ptr))
+ if (is_real_value || object_is_fully_known(o_ptr))
ac -= 30;
} else {
- if (is_true_value || object_is_fully_known(o_ptr))
+ if (is_real_value || object_is_fully_known(o_ptr))
ac -= 10;
}
}
- if ((i == INVEN_LARM) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) {
+ if ((i == INVEN_SUB_HAND) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI))) {
ac += 5;
}
}
ac += 10 + (creature_ptr->lev * 2 / 5);
}
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_TINYTHORN)) {
ac += 10;
}
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_MUSASI_KATANA)
+ && (creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_MUSASI_WAKIZASI)) {
ac += 10;
}
if (!(creature_ptr->inventory_list[INVEN_OUTER].k_idx) && (creature_ptr->lev > 15)) {
ac += ((creature_ptr->lev - 13) / 3);
}
- if (!(creature_ptr->inventory_list[INVEN_LARM].k_idx) && (creature_ptr->lev > 10)) {
+ if (!(creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx) && (creature_ptr->lev > 10)) {
ac += ((creature_ptr->lev - 8) / 3);
}
if (!(creature_ptr->inventory_list[INVEN_HEAD].k_idx) && (creature_ptr->lev > 4)) {
ac += (creature_ptr->lev - 2) / 3;
}
- if (!(creature_ptr->inventory_list[INVEN_HANDS].k_idx)) {
+ if (!(creature_ptr->inventory_list[INVEN_ARMS].k_idx)) {
ac += (creature_ptr->lev / 2);
}
if (!(creature_ptr->inventory_list[INVEN_FEET].k_idx)) {
ac += 30;
}
- for (inventory_slot_type i = INVEN_RARM; i <= INVEN_FEET; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i <= INVEN_FEET; i++) {
object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
}
}
- if (creature_ptr->special_defense & KAMAE_BYAKKO) {
+ if (creature_ptr->special_defense & KAMAE_GENBU) {
+ ac += (creature_ptr->lev * creature_ptr->lev) / 50;
+ } else if (creature_ptr->special_defense & KAMAE_BYAKKO) {
ac -= 40;
} else if (creature_ptr->special_defense & KAMAE_SEIRYU) {
ac -= 50;
}
if (creature_ptr->pclass == CLASS_NINJA) {
- if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
- && (!creature_ptr->inventory_list[INVEN_LARM].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;
}
}
}
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr = &creature_ptr->inventory_list[i];
BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(creature_ptr, o_ptr, flgs);
if (creature_ptr->pclass == CLASS_NINJA) {
if (heavy_armor(creature_ptr)) {
pow -= (creature_ptr->lev) / 10;
- } else if ((!creature_ptr->inventory_list[INVEN_RARM].k_idx || has_right_hand_weapon(creature_ptr))
- && (!creature_ptr->inventory_list[INVEN_LARM].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)))
}
}
- if (creature_ptr->pclass == CLASS_FORCETRAINER && !(heavy_armor(creature_ptr))) {
+ if ((creature_ptr->pclass == CLASS_MONK || creature_ptr->pclass == CLASS_FORCETRAINER) && !(heavy_armor(creature_ptr))) {
if (!(is_specific_player_race(creature_ptr, RACE_KLACKON) || is_specific_player_race(creature_ptr, RACE_SPRITE)
|| (creature_ptr->pseikaku == PERSONALITY_MUNCHKIN)))
pow += (creature_ptr->lev) / 10;
pow += 10;
if (creature_ptr->muta3) {
-
if (creature_ptr->muta3 & MUT3_XTRA_FAT) {
pow -= 2;
}
}
}
- if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
+ if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND) && has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_QUICKTHORN)
+ && (creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_TINYTHORN)) {
pow += 7;
}
}
count = (int)calc_weight_limit(creature_ptr);
if (j > count)
pow -= ((j - count) / (count / 5));
-
} else {
monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
s16b calc_double_weapon_penalty(player_type *creature_ptr, INVENTORY_IDX slot)
{
int penalty = 0;
- if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM)) {
+ if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND) && has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
penalty = ((100 - creature_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - creature_ptr->inventory_list[slot].weight) / 8);
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_TINYTHORN)) {
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_QUICKTHORN) && (creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_TINYTHORN)) {
penalty = penalty / 2 - 5;
}
if (creature_ptr->easy_2weapon) {
if (penalty > 0)
penalty /= 2;
- } else if ((creature_ptr->inventory_list[INVEN_LARM].tval == TV_SWORD)
- && ((creature_ptr->inventory_list[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_LARM].sval == SV_WAKIZASHI))) {
+ } else if ((creature_ptr->inventory_list[INVEN_SUB_HAND].tval == TV_SWORD)
+ && ((creature_ptr->inventory_list[INVEN_SUB_HAND].sval == SV_MAIN_GAUCHE) || (creature_ptr->inventory_list[INVEN_SUB_HAND].sval == SV_WAKIZASHI))) {
penalty = MAX(0, penalty - 10);
}
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI)) {
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_MUSASI_KATANA)
+ && (creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_MUSASI_WAKIZASI)) {
penalty = MIN(0, penalty);
} else {
- if ((creature_ptr->inventory_list[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty > 0))
+ if ((creature_ptr->inventory_list[INVEN_MAIN_HAND].name1 == ART_MUSASI_KATANA) && (penalty > 0))
penalty /= 2;
- if ((creature_ptr->inventory_list[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty > 0))
+ if ((creature_ptr->inventory_list[INVEN_SUB_HAND].name1 == ART_MUSASI_WAKIZASI) && (penalty > 0))
penalty /= 2;
}
case CLASS_MONK:
case CLASS_FORCETRAINER:
case CLASS_BERSERKER:
- if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_RARM)
- && !has_melee_weapon(creature_ptr, INVEN_LARM))
+ if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)
+ && !has_melee_weapon(creature_ptr, INVEN_SUB_HAND))
creature_ptr->riding_ryoute = TRUE;
break;
}
if (creature_ptr->old_heavy_wield[i] != creature_ptr->heavy_wield[i]) {
if (creature_ptr->heavy_wield[i]) {
msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
- } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
+ } else if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) {
msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
} else if (creature_ptr->heavy_wield[1 - i]) {
msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
} else if (!creature_ptr->riding) {
msg_print(_("この武器は徒歩で使いやすい。", "This weapon is suitable for use on foot."));
- } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
+ } else if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) {
msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
}
if (current_world_ptr->is_loading_now) {
chg_virtue(creature_ptr, V_FAITH, -1);
}
- } else if (has_melee_weapon(creature_ptr, INVEN_RARM + i)) {
+ } else if (has_melee_weapon(creature_ptr, INVEN_MAIN_HAND + i)) {
msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
} else {
msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
}
}
-static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
+static s16b calc_to_damage(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
{
object_type *o_ptr = &creature_ptr->inventory_list[slot];
- int id = slot - INVEN_RARM;
BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(creature_ptr, o_ptr, flgs);
+ player_hand calc_hand = PLAYER_HAND_OTHER;
+ if (slot == INVEN_MAIN_HAND)
+ calc_hand = PLAYER_HAND_MAIN;
+ if (slot == INVEN_SUB_HAND)
+ calc_hand = PLAYER_HAND_SUB;
+
s16b damage = 0;
damage += ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128);
damage -= 2;
} else if (creature_ptr->pclass == CLASS_BERSERKER) {
damage += creature_ptr->lev / 6;
- if (((id == 0) && !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) {
} else {
damage -= 10;
}
+ } else if (creature_ptr->pclass == CLASS_FORCETRAINER) {
+ // 練気術師は格闘ダメージに (気)/5 の修正を得る。
+ if (is_martial_arts_mode(creature_ptr) && calc_hand == PLAYER_HAND_MAIN) {
+ damage += get_current_ki(creature_ptr) / 5;
+ }
}
if ((creature_ptr->realm1 == REALM_HEX) && object_is_cursed(o_ptr)) {
}
}
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
int bonus_to_d = 0;
o_ptr = &creature_ptr->inventory_list[i];
- if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
- || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
+ if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_MAIN_HAND && has_melee_weapon(creature_ptr, i))
+ || (i == INVEN_SUB_HAND && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
continue;
- if (!object_is_known(o_ptr) && !is_true_value)
+ if (!object_is_known(o_ptr) && !is_real_value)
continue;
bonus_to_d = o_ptr->to_d;
bonus_to_d = (o_ptr->to_d + 1) / 2;
}
- if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
- damage += (s16b)bonus_to_d;
- } else if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
- if (id == 0)
- damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
- if (id == 1)
- damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
- } else if (id == get_default_hand(creature_ptr)) {
- damage += (s16b)bonus_to_d;
+ switch (player_melee_type(creature_ptr)) {
+ case MELEE_TYPE_BAREHAND_TWO: /* fall through */
+ case MELEE_TYPE_WEAPON_TWOHAND:
+ if (calc_hand == main_attack_hand(creature_ptr))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case MELEE_TYPE_BAREHAND_MAIN: /* fall through */
+ case MELEE_TYPE_WEAPON_MAIN:
+ if ((calc_hand == PLAYER_HAND_MAIN) && (i != INVEN_SUB_RING))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case MELEE_TYPE_BAREHAND_SUB: /* fall through */
+ case MELEE_TYPE_WEAPON_SUB:
+ if ((calc_hand == PLAYER_HAND_SUB) && (i != INVEN_MAIN_RING))
+ damage += (s16b)bonus_to_d;
+ break;
+
+ case MELEE_TYPE_WEAPON_DOUBLE:
+ if ((calc_hand == PLAYER_HAND_MAIN)) {
+ if (i == INVEN_MAIN_RING) {
+ damage += (s16b)bonus_to_d;
+ } else if (i != INVEN_SUB_RING) {
+ damage += (bonus_to_d > 0) ? (bonus_to_d + 1) / 2 : bonus_to_d;
+ }
+ }
+ if ((calc_hand == PLAYER_HAND_SUB)) {
+ if (i == INVEN_SUB_RING) {
+ damage += (s16b)bonus_to_d;
+ } else if (i != INVEN_MAIN_RING) {
+ damage += (bonus_to_d > 0) ? bonus_to_d / 2 : bonus_to_d;
+ }
+ }
+ break;
+
+ case MELEE_TYPE_SHIELD_DOUBLE:
+ break;
+
+ default:
+ break;
}
}
- if (get_default_hand(creature_ptr) == id) {
- if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
+ if (main_attack_hand(creature_ptr) == calc_hand) {
+ if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB))
|| !has_disable_two_handed_bonus(creature_ptr, 0)) {
int bonus_to_d = 0;
bonus_to_d = ((int)(adj_str_td[creature_ptr->stat_ind[A_STR]]) - 128) / 2;
damage += (creature_ptr->lev / 6);
}
+ // 朱雀の構えをとっているとき、格闘ダメージに -(レベル)/6 の修正を得る。
+ if (creature_ptr->special_defense & KAMAE_SUZAKU) {
+ if (is_martial_arts_mode(creature_ptr) && calc_hand == PLAYER_HAND_MAIN) {
+ damage -= (creature_ptr->lev / 6);
+ }
+ }
+
return damage;
}
/*!
* @brief 武器の命中修正を計算する。 / Calculate hit bonus from a wielded weapon.
* @details
- * 'slot' MUST be INVEN_RARM or INVEM_LARM.
+ * 'slot' MUST be INVEN_MAIN_HAND or INVEM_SUB_HAND.
*/
-static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_true_value)
+static s16b calc_to_hit(player_type *creature_ptr, INVENTORY_IDX slot, bool is_real_value)
{
s16b hit = 0;
hit -= 5;
}
+ player_hand calc_hand = PLAYER_HAND_OTHER;
+ if (slot == INVEN_MAIN_HAND)
+ calc_hand = PLAYER_HAND_MAIN;
+ if (slot == INVEN_SUB_HAND)
+ calc_hand = PLAYER_HAND_SUB;
+
/* Default hand bonuses */
- int id = slot - INVEN_RARM;
- int default_hand = get_default_hand(creature_ptr);
- if (default_hand == id) {
- /* Add trained bonus of empty hands' combat when having no weapon and riding */
- if ((!has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_LARM))
- || (!has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, TRUE) & EMPTY_HAND_RARM))) {
+ if (main_attack_hand(creature_ptr) == calc_hand) {
+ switch (player_melee_type(creature_ptr)) {
+ case MELEE_TYPE_BAREHAND_MAIN:
+ if (creature_ptr->riding)
+ break;
+ /* fall through */
+ case MELEE_TYPE_BAREHAND_SUB:
+ if (creature_ptr->riding)
+ break;
+ /* fall through */
+ case MELEE_TYPE_BAREHAND_TWO:
hit += (creature_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
}
- if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
+ if ((is_martial_arts_mode(creature_ptr) && empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB))
|| !has_disable_two_handed_bonus(creature_ptr, 0)) {
int bonus_to_h = 0;
bonus_to_h = ((int)(adj_str_th[creature_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[creature_ptr->stat_ind[A_DEX]]) - 128);
}
/* Low melee penalty */
- if ((object_is_fully_known(o_ptr) || is_true_value) && o_ptr->curse_flags & TRC_LOW_MELEE) {
+ if ((object_is_fully_known(o_ptr) || is_real_value) && o_ptr->curse_flags & TRC_LOW_MELEE) {
if (o_ptr->curse_flags & TRC_HEAVY_CURSE) {
hit -= 15;
} else {
if (creature_ptr->riding != 0 && !(o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))
&& !has_flag(flgs, TR_RIDING)) {
-
int penalty;
if ((creature_ptr->pclass == CLASS_BEASTMASTER) || (creature_ptr->pclass == CLASS_CAVALRY)) {
penalty = 5;
hit -= 2;
} else if (creature_ptr->pclass == CLASS_BERSERKER) {
hit += creature_ptr->lev / 5;
- if (((id == 0) && !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) {
}
}
- if (has_not_ninja_weapon(creature_ptr, id) || has_not_monk_weapon(creature_ptr, id)) {
+ if (has_not_ninja_weapon(creature_ptr, (int)calc_hand) || has_not_monk_weapon(creature_ptr, (int)calc_hand)) {
hit -= 40;
}
}
/* Bonuses from inventory */
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
object_type *o_ptr = &creature_ptr->inventory_list[i];
/* Ignore empty hands, handed weapons, bows and capture balls */
- if (!o_ptr->k_idx
- || o_ptr->tval == TV_CAPTURE
- || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
- || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i))
- || i == INVEN_BOW)
+ if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_MAIN_HAND && has_melee_weapon(creature_ptr, i))
+ || (i == INVEN_SUB_HAND && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
continue;
/* Fake value does not include unknown objects' value */
- if (is_true_value || !object_is_known(o_ptr))
+ if (!object_is_known(o_ptr) && !is_real_value)
continue;
int bonus_to_h = o_ptr->to_h;
bonus_to_h = (o_ptr->to_h + 1) / 2;
}
- if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !has_two_handed_weapons(creature_ptr)) {
- hit += (s16b)bonus_to_h;
- continue;
- }
+ switch (player_melee_type(creature_ptr)) {
+ case MELEE_TYPE_BAREHAND_TWO: /* fall through */
+ case MELEE_TYPE_WEAPON_TWOHAND:
+ if (calc_hand == main_attack_hand(creature_ptr))
+ hit += (s16b)bonus_to_h;
+ break;
- /* When wields two weapons on each hand */
- if (has_right_hand_weapon(creature_ptr) && has_left_hand_weapon(creature_ptr)) {
- if (default_hand == 0)
- hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
- if (default_hand == 1)
- hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
- continue;
- }
+ case MELEE_TYPE_BAREHAND_MAIN: /* fall through */
+ case MELEE_TYPE_WEAPON_MAIN:
+ if ((calc_hand == PLAYER_HAND_MAIN) && (i != INVEN_SUB_RING))
+ hit += (s16b)bonus_to_h;
+ break;
+
+ case MELEE_TYPE_BAREHAND_SUB: /* fall through */
+ case MELEE_TYPE_WEAPON_SUB:
+ if ((calc_hand == PLAYER_HAND_SUB) && (i != INVEN_MAIN_RING))
+ hit += (s16b)bonus_to_h;
+ break;
+
+ case MELEE_TYPE_WEAPON_DOUBLE:
+ if ((calc_hand == PLAYER_HAND_MAIN)) {
+ if (i == INVEN_MAIN_RING) {
+ hit += (s16b)bonus_to_h;
+ } else if (i != INVEN_SUB_RING) {
+ hit += (bonus_to_h > 0) ? (bonus_to_h + 1) / 2 : bonus_to_h;
+ }
+ }
+ if ((calc_hand == PLAYER_HAND_SUB)) {
+ if (i == INVEN_SUB_RING) {
+ hit += (s16b)bonus_to_h;
+ } else if (i != INVEN_MAIN_RING) {
+ hit += (bonus_to_h > 0) ? bonus_to_h / 2 : bonus_to_h;
+ }
+ }
+ break;
+
+ case MELEE_TYPE_SHIELD_DOUBLE:
+ break;
- if (default_hand == id)
- hit += (s16b)bonus_to_h;
+ default:
+ break;
+ }
}
/* Martial arts bonus */
/* Two handed combat penalty */
hit -= calc_double_weapon_penalty(creature_ptr, slot);
+ // 朱雀の構えをとっているとき、格闘命中に -(レベル)/3 の修正を得る。
+ if (creature_ptr->special_defense & KAMAE_SUZAKU) {
+ if (is_martial_arts_mode(creature_ptr) && calc_hand == PLAYER_HAND_MAIN) {
+ hit -= (creature_ptr->lev / 3);
+ }
+ }
+
return hit;
}
-static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_true_value)
+static s16b calc_to_hit_bow(player_type *creature_ptr, bool is_real_value)
{
s16b pow = 0;
}
// 武器以外の装備による修正
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
int bonus_to_h;
o_ptr = &creature_ptr->inventory_list[i];
- if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_RARM && has_melee_weapon(creature_ptr, i))
- || (i == INVEN_LARM && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
+ if (!o_ptr->k_idx || o_ptr->tval == TV_CAPTURE || (i == INVEN_MAIN_HAND && has_melee_weapon(creature_ptr, i))
+ || (i == INVEN_SUB_HAND && has_melee_weapon(creature_ptr, i)) || i == INVEN_BOW)
continue;
bonus_to_h = o_ptr->to_h;
bonus_to_h = (o_ptr->to_h + 1) / 2;
}
- if (is_true_value || object_is_known(o_ptr))
+ if (is_real_value || object_is_known(o_ptr))
pow += (s16b)bonus_to_h;
}
s16b to_dam = 0;
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
s16b to_hit = 0;
- for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+ for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx)
continue;
DICE_NUMBER dn = 0;
if (creature_ptr->riding) {
-
if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE))) {
dn += 2;
}
/*!
* @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
- * @param i 判定する手のID(右手:INVEN_RARM 左手:INVEN_LARM)
+ * @param i 判定する手のID(右手:INVEN_MAIN_HAND 左手:INVEN_SUB_HAND)
* @return 持っているならばTRUE
*/
bool has_melee_weapon(player_type *creature_ptr, int slot)
BIT_FLAGS16 empty_hands(player_type *creature_ptr, bool riding_control)
{
BIT_FLAGS16 status = EMPTY_HAND_NONE;
- if (!creature_ptr->inventory_list[INVEN_RARM].k_idx)
- status |= EMPTY_HAND_RARM;
- if (!creature_ptr->inventory_list[INVEN_LARM].k_idx)
- status |= EMPTY_HAND_LARM;
+ if (!creature_ptr->inventory_list[INVEN_MAIN_HAND].k_idx)
+ status |= EMPTY_HAND_MAIN;
+ if (!creature_ptr->inventory_list[INVEN_SUB_HAND].k_idx)
+ status |= EMPTY_HAND_SUB;
if (riding_control && (status != EMPTY_HAND_NONE) && creature_ptr->riding && !(creature_ptr->pet_extra_flags & PF_TWO_HANDS)) {
- if (status & EMPTY_HAND_LARM)
- status &= ~(EMPTY_HAND_LARM);
- else if (status & EMPTY_HAND_RARM)
- status &= ~(EMPTY_HAND_RARM);
+ if (status & EMPTY_HAND_SUB)
+ status &= ~(EMPTY_HAND_SUB);
+ else if (status & EMPTY_HAND_MAIN)
+ status &= ~(EMPTY_HAND_MAIN);
}
return status;
return FALSE;
WEIGHT monk_arm_wgt = 0;
- if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD)
- monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
- if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD)
- monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
+ if (creature_ptr->inventory_list[INVEN_MAIN_HAND].tval > TV_SWORD)
+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_MAIN_HAND].weight;
+ if (creature_ptr->inventory_list[INVEN_SUB_HAND].tval > TV_SWORD)
+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_SUB_HAND].weight;
monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
- monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_ARMS].weight;
monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
return weight;
}
-static int get_default_hand(player_type *creature_ptr)
+static player_hand main_attack_hand(player_type *creature_ptr)
{
- int default_hand = 0;
-
- if (has_melee_weapon(creature_ptr, INVEN_LARM)) {
- if (!has_right_hand_weapon(creature_ptr))
- default_hand = 1;
- }
-
- if (can_two_hands_wielding(creature_ptr)) {
- if (has_right_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
- && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
- } else if (has_left_hand_weapon(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
- && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
- } else {
- default_hand = 1;
- }
+ switch (player_melee_type(creature_ptr)) {
+ case MELEE_TYPE_BAREHAND_TWO:
+ return PLAYER_HAND_MAIN;
+ case MELEE_TYPE_BAREHAND_MAIN:
+ return PLAYER_HAND_MAIN;
+ case MELEE_TYPE_BAREHAND_SUB:
+ return PLAYER_HAND_SUB;
+ case MELEE_TYPE_WEAPON_MAIN:
+ return PLAYER_HAND_MAIN;
+ case MELEE_TYPE_WEAPON_SUB:
+ return PLAYER_HAND_SUB;
+ case MELEE_TYPE_WEAPON_TWOHAND:
+ return PLAYER_HAND_MAIN;
+ case MELEE_TYPE_WEAPON_DOUBLE:
+ return PLAYER_HAND_MAIN;
+ case MELEE_TYPE_SHIELD_DOUBLE:
+ return PLAYER_HAND_MAIN;
}
-
- return default_hand;
+ return 0;
}