Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent counterattacking with large/fragile items #36704

Merged
merged 1 commit into from
Jan 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,12 @@ void player::melee_attack( Creature &t, bool allow_special, const matec_id &forc
}
}
item &cur_weapon = allow_unarmed ? used_weapon() : weapon;

if( cur_weapon.attack_time() > attack_speed( cur_weapon ) * 20 ) {
add_msg( m_bad, _( "This weapon is too unwieldy to attack with!" ) );
return;
}

const bool critical_hit = scored_crit( t.dodge_roll(), cur_weapon );
int move_cost = attack_speed( cur_weapon );

Expand Down Expand Up @@ -1686,6 +1692,8 @@ bool player::block_hit( Creature *source, body_part &bp_hit, damage_instance &da
if( tec != tec_none && !is_dead_state() ) {
if( get_stamina() < get_stamina_max() / 3 ) {
add_msg( m_bad, _( "You try to counterattack but you are too exhausted!" ) );
} else if( weapon.made_of( material_id( "glass" ) ) ) {
add_msg( m_bad, _( "The item you are wielding is too fragile to counterattack with!" ) );
} else {
melee_attack( *source, false, tec );
}
Expand Down