diff --git src/attack.c src/attack.c index e254e50..966887e 100644 --- src/attack.c +++ src/attack.c @@ -109,11 +109,11 @@ static int critical_shot(int weight, int plus, int dam, u32b *msg_type) { * * Factor in weapon weight, total plusses, player level. */ -static int critical_norm(int weight, int plus, int dam, u32b *msg_type) { +static int critical_norm(int weight, int plus, int dam, u32b *msg_type, bool nocheck) { int chance = weight + (p_ptr->state.to_h + plus) * 5 + p_ptr->lev * 3; int power = weight + randint1(650); - if (randint1(5000) > chance) { + if (!nocheck && randint1(5000) > chance) { *msg_type = MSG_HIT; return dam; @@ -159,6 +159,9 @@ static bool py_attack_real(int y, int x, bool *fear) { bool do_quake = FALSE; bool success = FALSE; + /* Information about the monster */ + bool sleep_org = m_ptr->m_timed[MON_TMD_SLEEP]; + /* Default to punching for one damage */ const char *hit_verb = "punch"; int dmg = 1; @@ -214,7 +217,7 @@ static bool py_attack_real(int y, int x, bool *fear) { dmg *= (best_s_ptr == NULL) ? 1 : best_s_ptr->mult; dmg += o_ptr->to_d; - dmg = critical_norm(o_ptr->weight, o_ptr->to_h, dmg, &msg_type); + dmg = critical_norm(o_ptr->weight, o_ptr->to_h, dmg, &msg_type, sleep_org); /* Learn by use for the weapon */ object_notice_attack_plusses(o_ptr); @@ -568,6 +571,7 @@ static struct attack_result make_ranged_throw(object_type *o_ptr, int y, int x) int bonus = p_ptr->state.to_h + o_ptr->to_h; int chance = p_ptr->state.skills[SKILL_TO_HIT_THROW] + bonus * BTH_PLUS_ADJ; int chance2 = chance - distance(p_ptr->py, p_ptr->px, y, x); + bool sleep_org = m_ptr->m_timed[MON_TMD_SLEEP]; int multiplier = 1; const struct slay *best_s_ptr = NULL; @@ -589,7 +593,7 @@ static struct attack_result make_ranged_throw(object_type *o_ptr, int y, int x) result.dmg = damroll(o_ptr->dd, o_ptr->ds); result.dmg += o_ptr->to_d; result.dmg *= multiplier; - result.dmg = critical_norm(o_ptr->weight, o_ptr->to_h, result.dmg, &result.msg_type); + result.dmg = critical_norm(o_ptr->weight, o_ptr->to_h, result.dmg, &result.msg_type, sleep_org); return result; }