mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Adds armor penetration system
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
var/damtype = "brute"
|
||||
var/force = 0
|
||||
var/armorpen = 0
|
||||
|
||||
/obj/Destroy()
|
||||
processing_objects -= src
|
||||
|
||||
@@ -227,7 +227,7 @@ emp_act
|
||||
else
|
||||
visible_message("\red <B>[src] has been attacked in the [hit_area] with [I.name] by [user]!</B>")
|
||||
|
||||
var/armor = run_armor_check(affecting, "melee", "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].")
|
||||
var/armor = run_armor_check(affecting, "melee", I.armorpen, "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].")
|
||||
var/weapon_sharp = is_sharp(I)
|
||||
var/weapon_edge = has_edge(I)
|
||||
if ((weapon_sharp || weapon_edge) && prob(getarmor(target_zone, "melee")))
|
||||
@@ -342,7 +342,7 @@ emp_act
|
||||
var/hit_area = affecting.name
|
||||
|
||||
src.visible_message("\red [src] has been hit in the [hit_area] by [O].")
|
||||
var/armor = run_armor_check(affecting, "melee", "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].") //I guess "melee" is the best fit here
|
||||
var/armor = run_armor_check(affecting, "melee", O.armorpen, "Your armor has protected your [hit_area].", "Your armor has softened hit to your [hit_area].") //I guess "melee" is the best fit here
|
||||
|
||||
if(armor < 2)
|
||||
apply_damage(throw_damage, dtype, zone, armor, is_sharp(O), has_edge(O), O)
|
||||
|
||||
@@ -10,24 +10,33 @@
|
||||
1 - halfblock
|
||||
2 - fullblock
|
||||
*/
|
||||
/mob/living/proc/run_armor_check(var/def_zone = null, var/attack_flag = "melee", var/absorb_text = null, var/soften_text = null)
|
||||
/mob/living/proc/run_armor_check(var/def_zone = null, var/attack_flag = "melee", var/armour_pen = 0, var/absorb_text = null, var/soften_text = null)
|
||||
var/armor = getarmor(def_zone, attack_flag)
|
||||
var/absorb = 0
|
||||
|
||||
//Roll armour
|
||||
if(prob(armor))
|
||||
absorb += 1
|
||||
if(prob(armor))
|
||||
absorb += 1
|
||||
|
||||
//Roll penetration
|
||||
if(prob(armour_pen))
|
||||
absorb -= 1
|
||||
if(prob(armour_pen))
|
||||
absorb -= 1
|
||||
|
||||
if(absorb >= 2)
|
||||
if(absorb_text)
|
||||
show_message("[absorb_text]")
|
||||
else
|
||||
show_message("\red Your armor absorbs the blow!")
|
||||
show_message("<span class='warning'>Your armor absorbs the blow!</span>")
|
||||
return 2
|
||||
if(absorb == 1)
|
||||
if(absorb_text)
|
||||
show_message("[soften_text]",4)
|
||||
else
|
||||
show_message("\red Your armor softens the blow!")
|
||||
show_message("<span class='warning'>Your armor softens the blow!</span>")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@@ -64,7 +73,7 @@
|
||||
return
|
||||
|
||||
//Armor
|
||||
var/absorb = run_armor_check(def_zone, P.check_armour)
|
||||
var/absorb = run_armor_check(def_zone, P.check_armour, P.armorpen)
|
||||
var/proj_sharp = is_sharp(P)
|
||||
var/proj_edge = has_edge(P)
|
||||
if ((proj_sharp || proj_edge) && prob(getarmor(def_zone, P.check_armour)))
|
||||
|
||||
Reference in New Issue
Block a user