Merge pull request #12390 from KorPhaeron/AP2

Another slight tweak to armour penetration
This commit is contained in:
Razharas
2015-10-16 20:09:02 +03:00
2 changed files with 44 additions and 5 deletions
@@ -82,17 +82,20 @@ emp_act
/mob/living/carbon/human/proc/check_shields(damage = 0, attack_text = "the attack", atom/movable/AM, thrown_proj = 0, armour_penetration = 0)
var/block_chance = 50 + 30*thrown_proj - round(damage / 3) //thrown things are easier to block
block_chance -= armour_penetration
if(AM)
if(AM.flags & NOSHIELD) //weapon ignores shields altogether
return 0
var/blocker
if(l_hand)
if(l_hand.IsShield() && prob(block_chance))
blocker = l_hand
if(l_hand.IsShield())
block_chance -= Clamp((armour_penetration-l_hand.armour_penetration)/2,0,100) //So armour piercing blades can still be parried by other blades, for example
if(prob(block_chance))
blocker = l_hand
if(r_hand)
if(r_hand.IsShield() && prob(block_chance))
blocker = r_hand
if(r_hand.IsShield())
block_chance -= Clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)
if(prob(block_chance))
blocker = r_hand
if(blocker)
visible_message("<span class='danger'>[src] blocks [attack_text] with [blocker]!</span>", \
"<span class='userdanger'>[src] blocks [attack_text] with [blocker]!</span>")