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

Fix counter stunlock #45138

Merged
merged 1 commit into from
Oct 29, 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
19 changes: 10 additions & 9 deletions src/melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,20 +1221,21 @@ matec_id Character::pick_technique( Creature &t, const item &weap,
continue;
}

// skip dodge counter techniques if it's not a dodge count, and vice versa
if( dodge_counter != tec.dodge_counter ) {
continue;
}
// likewise for block counters
if( block_counter != tec.block_counter ) {
continue;
}

// Don't counter if it would exhaust moves.
if( tec.block_counter || tec.dodge_counter ) {
// skip dodge counter techniques
if( dodge_counter != tec.dodge_counter ) {
continue;
}
// skip block counter techniques
if( block_counter != tec.block_counter ) {
continue;
}
int move_cost = attack_speed( used_weapon() );
move_cost *= tec.move_cost_multiplier( *this );
move_cost += tec.move_cost_penalty( *this );

// Don't counter if it would exhaust moves.
if( get_moves() + get_speed() - move_cost < 0 ) {
continue;
}
Expand Down