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

refactor shield calculations #2

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
chaosvolt and github-actions[bot] authored May 20, 2023
commit ed857bba25bf7571bf1fd568771100380af2e02c
3 changes: 2 additions & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10650,7 +10650,8 @@ bool Character::block_ranged_hit( Creature *source, bodypart_id &bp_hit, damage_
// 1. Best item available doesn't count as a shield.
// 2. Shield already protects the part we're interested in.
// 3. Targeted bodypart is a foot, unlikely to ever successfully block that low.
if( !shield.has_flag( "BLOCK_WHILE_WORN" ) || shield.covers( bp_hit->token ) || bp_hit == bodypart_str_id( "foot_l" ) || bp_hit == bodypart_str_id( "foot_r" ) ) {
if( !shield.has_flag( "BLOCK_WHILE_WORN" ) || shield.covers( bp_hit->token ) ||
bp_hit == bodypart_str_id( "foot_l" ) || bp_hit == bodypart_str_id( "foot_r" ) ) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Creature

// handles interaction of shields and ranged attacks. mutates &dam
virtual bool block_ranged_hit( Creature *source, bodypart_id &bp_hit,
damage_instance &dam ) = 0;
damage_instance &dam ) = 0;

// handles armor absorption (including clothing damage etc)
// of damage instance. mutates &dam
Expand Down