Skip to content
This repository has been archived by the owner on Mar 14, 2020. It is now read-only.

The indentation used in this block causes it to appear that the damage <= 0 guard is guarded by the first "if" when it is not #58

Merged
merged 2 commits into from
May 25, 2017
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
14 changes: 8 additions & 6 deletions src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,12 +515,14 @@ BlockType Actor::blockHit(CombatType combatType, const CombatSource& combatSourc
elementMod = it->second;
}

if(elementMod != 0)
damage = (int32_t)std::ceil(damage * ((float)(100 - elementMod) / 100));
if(damage <= 0){
damage = 0;
blockType = BLOCK_DEFENSE;
}
if(elementMod != 0){
damage = (int32_t)std::ceil(damage * ((float)(100 - elementMod) / 100));
}

if(damage <= 0){
damage = 0;
blockType = BLOCK_DEFENSE;
}
}

return blockType;
Expand Down