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 free counters #44533

Merged
merged 3 commits into from
Oct 2, 2020
Merged
Changes from 1 commit
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
Next Next commit
Don't counterattack if it would exhaust our moves for the next turn
  • Loading branch information
kevingranade committed Oct 1, 2020
commit 9945f828611f351bce4ac40cfe8d9f104dda2e62
23 changes: 16 additions & 7 deletions src/melee.cpp
Original file line number Diff line number Diff line change
@@ -1221,14 +1221,23 @@ matec_id Character::pick_technique( Creature &t, const item &weap,
continue;
}

// skip dodge counter techniques
if( dodge_counter != tec.dodge_counter ) {
continue;
}
if( tec.block_counter || tec.dodge_counter ) {
kevingranade marked this conversation as resolved.
Show resolved Hide resolved
// 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 );

// skip block counter techniques
if( block_counter != tec.block_counter ) {
continue;
// Don't counter if it would exhaust moves.
if( get_moves() + get_speed() - move_cost < 0 ) {
continue;
}
}

// if critical then select only from critical tecs