From 7a2647afb480cb7b2cf9c3dae504dee6c06ecbfd Mon Sep 17 00:00:00 2001 From: n3ophyt3 Date: Tue, 10 May 2011 00:13:04 +0000 Subject: [PATCH] Armor overhaul, phase 1. Armor protection rates are now handled by checking the var I added to obj/item/clothing instead of static percentile chances in the robusting code. What this means for the future is armors that differ in more than just bodyparts protected. Currently, all armors/helmets are running off the same set of protective values, which are roughly identical to the old hardcoded ones. a future phase will juggle these numbers around. What this means for right now: *Melee attacks to the chest/groin are slightly more likely to succeed than before. (80%-force block chance instead of 90%-force) *Bullets are slightly more likely to penetrate armor than before. (60% block/30% partial instead of 70%/40%) *Alien spit/e-crossbow bolts have a 10% chance of being blocked by armor. Lasers/Pulse Rifles/Tasers have unchanged values, as do melee head/arm/leg/hand/foot shots. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1561 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/obj/clothing.dm | 2 +- code/defines/obj/clothing/head.dm | 1 + code/defines/obj/clothing/suit.dm | 1 + code/game/objects/items/item.dm | 6 +- code/modules/mob/living/carbon/human/human.dm | 96 +++++++++---------- 5 files changed, 53 insertions(+), 53 deletions(-) diff --git a/code/defines/obj/clothing.dm b/code/defines/obj/clothing.dm index 07cd4063dc1..ccfe0f81197 100644 --- a/code/defines/obj/clothing.dm +++ b/code/defines/obj/clothing.dm @@ -18,7 +18,7 @@ var/radiation_protection = 0.0 //percentage of radiation it will absorb var/canremove = 1 //Mostly for Ninja code at this point but basically will not allow the item to be removed if set to 0. /N - + var/armor = list(melee = 0, bullet = 0, laser = 0, taser = 0, bomb = 0, bio = 0) diff --git a/code/defines/obj/clothing/head.dm b/code/defines/obj/clothing/head.dm index 3d9e50a99b9..47e57c83ab5 100644 --- a/code/defines/obj/clothing/head.dm +++ b/code/defines/obj/clothing/head.dm @@ -133,6 +133,7 @@ icon_state = "helmet" flags = FPRINT|TABLEPASS|SUITSPACE|HEADCOVERSEYES item_state = "helmet" + armor = list(melee = 80, bullet = 60, laser = 40, taser = 5, bomb = 0) protective_temperature = 500 heat_transfer_coefficient = 0.10 diff --git a/code/defines/obj/clothing/suit.dm b/code/defines/obj/clothing/suit.dm index 78caeba741b..a9cedc063c9 100644 --- a/code/defines/obj/clothing/suit.dm +++ b/code/defines/obj/clothing/suit.dm @@ -180,6 +180,7 @@ /obj/item/clothing/suit/armor allowed = list(/obj/item/weapon/gun/energy,/obj/item/weapon/gun/revolver,/obj/item/weapon/baton,/obj/item/weapon/handcuffs) + armor = list(melee = 80, bullet = 60, laser = 40, taser = 5, bomb = 0, bio = 10) /obj/item/clothing/suit/armor/vest name = "armor" diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index 81d4cb8bc3f..97418516d61 100644 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -201,7 +201,7 @@ if (M.mutations & COLD_RESISTANCE) f_dam = 0 if (def_zone == "head") - if (b_dam && H.isarmored(affecting) && prob(80 - src.force)) + if (b_dam && prob(H.isarmored(affecting, "melee") - src.force)) if (prob(20)) affecting.take_damage(power, 0) else @@ -246,7 +246,7 @@ user2.w_uniform.add_blood(H) affecting.take_damage(b_dam, f_dam) else if (def_zone == "chest" || def_zone == "groin") - if (b_dam && H.isarmored(affecting) && prob(90 - src.force)) + if (b_dam && prob(H.isarmored(affecting, "melee") - src.force)) H.show_message("\red You have been protected from a hit to the [affecting.name].") return if (b_dam && ((istype(H.r_hand, /obj/item/weapon/shield/riot))) && prob(90 - src.force)) @@ -290,7 +290,7 @@ user2.w_uniform.add_blood(H) affecting.take_damage(b_dam, f_dam) else - if (b_dam && H.isarmored(affecting) && prob(80 - src.force)) + if (b_dam && prob(H.isarmored(affecting, "melee") - src.force)) H.show_message("\red You have been protected from a hit to the [affecting.name].") return if (b_dam && prob(25 + (b_dam * 2))) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 8140b57eea4..99a5185eb82 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -216,21 +216,19 @@ if (safe) return safe.bullet_act(flag, A) - var/armored = src.isarmored(affecting) switch(flag) if(PROJECTILE_BULLET) var/d = 51 - if (armored) - if (prob(70)) - show_message("\red Your armor absorbs the hit!", 4) - return - else - if (prob(40)) - show_message("\red Your armor only softens the hit!", 4) - if (prob(20)) - d = d / 2 - d = d / 4 + if (prob(src.isarmored(affecting, "bullet"))) + show_message("\red Your armor absorbs the hit!", 4) + return + else + if (prob(src.isarmored(affecting, "bullet")/2)) + show_message("\red Your armor only softens the hit!", 4) + if (prob(20)) + d = d / 2 + d = d / 4 /* else if (istype(src.wear_suit, /obj/item/clothing/suit/swat_suit)) @@ -272,10 +270,9 @@ if(src.weakened <= 5) src.weakened = 5 return if(PROJECTILE_TASER) - if (armored) - if (prob(5)) - show_message("\red Your armor absorbs the hit!", 4) - return + if (prob(src.isarmored(affecting, "taser"))) + show_message("\red Your armor absorbs the hit!", 4) + return /*else if (istype(src.wear_suit, /obj/item/clothing/suit/swat_suit)) if (prob(70)) @@ -288,6 +285,9 @@ if (src.stuttering < 10) src.stuttering = 10 if(PROJECTILE_DART) + if (prob(src.isarmored(affecting, "bio"))) + show_message("\red Your armor absorbs the hit!", 4) + return if (istype(src.l_hand, /obj/item/weapon/shield/riot)||istype(src.r_hand, /obj/item/weapon/shield/riot)) if (prob(50)) show_message("\red Your shield absorbs the hit!", 4) @@ -296,16 +296,15 @@ src.toxloss += 10 if(PROJECTILE_LASER) var/d = 20 - if (armored) - if (prob(40)) - show_message("\red Your armor absorbs the hit!", 4) - return - else - if (prob(40)) - show_message("\red Your armor only softens the hit!", 4) - if (prob(20)) - d = d / 2 + if (prob(src.isarmored(affecting, "laser"))) + show_message("\red Your armor absorbs the hit!", 4) + return + else + if (prob(src.isarmored(affecting, "laser"))) + show_message("\red Your armor only softens the hit!", 4) + if (prob(20)) d = d / 2 + d = d / 2 /*else if (istype(src.wear_suit, /obj/item/clothing/suit/swat_suit)) if (prob(70)) @@ -329,16 +328,15 @@ src.stunned = 1 if(PROJECTILE_PULSE) var/d = 40 - if (istype(src.wear_suit, /obj/item/clothing/suit/armor)) - if (prob(20)) - show_message("\red Your armor absorbs the hit!", 4) - return - else + if (prob(src.isarmored(affecting, "laser")/2)) + show_message("\red Your armor absorbs the hit!", 4) + return + else + if (prob(src.isarmored(affecting, "laser")/2)) + show_message("\red Your armor only softens the hit!", 4) if (prob(20)) - show_message("\red Your armor only softens the hit!", 4) - if (prob(20)) - d = d / 2 d = d / 2 + d = d / 2 /*else if (istype(src.wear_suit, /obj/item/clothing/suit/swat_suit)) if (prob(50)) @@ -357,6 +355,9 @@ if (prob(50)) src.stunned = min(src.stunned, 5) if(PROJECTILE_BOLT) + if (prob(src.isarmored(affecting, "bio"))) + show_message("\red Your armor absorbs the hit!", 4) + return src.toxloss += 3 src.radiation += 100 src.updatehealth() @@ -364,16 +365,15 @@ src.drowsyness += 5 if(PROJECTILE_WEAKBULLET) var/d = 14 - if (armored) - if (prob(70)) - show_message("\red Your armor absorbs the hit!", 4) - return - else - if (prob(40)) - show_message("\red Your armor only softens the hit!", 4) - if (prob(20)) - d = d / 2 - d = d / 4 + if (prob(src.isarmored(affecting, "bullet"))) + show_message("\red Your armor absorbs the hit!", 4) + return + else + if (prob(src.isarmored(affecting, "bullet")/2)) + show_message("\red Your armor only softens the hit!", 4) + if (prob(20)) + d = d / 2 + d = d / 4 /*else if (istype(src.wear_suit, /obj/item/clothing/suit/swat_suit)) if (prob(90)) @@ -2826,17 +2826,15 @@ It can still be worn/put on as normal. src.updatehealth() src.UpdateDamageIcon() -/mob/living/carbon/human/proc/isarmored(var/datum/organ/external/def_zone) +/mob/living/carbon/human/proc/isarmored(var/datum/organ/external/def_zone, var/type) if(def_zone.name == "head") - if(src.head && istype(src.head,/obj/item/clothing/head/helmet)) + if(src.head && istype(src.head,/obj/item/clothing)) if(def_zone.body_part & src.head.body_parts_covered) - return 1 - //If targetting the head and there's a helmet there, armored. + return src.head.armor[type] else - if(src.wear_suit && istype(src.wear_suit, /obj/item/clothing/suit/armor)) + if(src.wear_suit && istype(src.wear_suit, /obj/item/clothing)) if(def_zone.body_part & src.wear_suit.body_parts_covered) - return 1 - //If wearing armor that covers the targetted bodypart, armored. + return src.wear_suit.armor[type] return 0