From f1eb7971e1bea5f100b8339bcd28a53b386026fa Mon Sep 17 00:00:00 2001 From: DZD Date: Sat, 17 Jan 2015 22:33:47 -0500 Subject: [PATCH] Armor/Damage Changes - Fixes armor RNG killing for thrown items. - Kidan no longer act like they have a built-in riot shield (50 - damage/3)% chance to ignore damage, but take 20% less brute consistently. - Entirely missing with a projectile or melee attack is impossible, but you are more likely to hit a part you were not aiming at. (Ports tg ran_zone proc and axes current get_zone_with_miss_chance proc). - Removes some snowflake code for lightning projectiles (Power Glove traitor item uses these). --- .../mob/living/carbon/human/human_defense.dm | 33 ++------- code/modules/mob/living/carbon/species.dm | 5 +- code/modules/mob/living/living_defense.dm | 5 +- code/modules/mob/mob_helpers.dm | 72 ++++--------------- code/modules/projectiles/projectile.dm | 17 +---- 5 files changed, 25 insertions(+), 107 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 46861b76b66..b5fc2673286 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -185,9 +185,6 @@ emp_act buckled.unbuckle() src.loc = picked return 1 - if(species.flags & HAS_CHITTIN && (prob(50 - round(damage / 3)))) - visible_message("\red The [attack_text] bounces off [src]' natural armor!") - return 1 return 0 /mob/living/carbon/human/emp_act(severity) @@ -206,14 +203,6 @@ emp_act /mob/living/carbon/human/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone) if(!I || !user) return 0 - var/target_zone = def_zone? check_zone(def_zone) : get_zone_with_miss_chance(user.zone_sel.selecting, src) - - if(user == src) // Attacking yourself can't miss - target_zone = user.zone_sel.selecting - if(!target_zone && !src.stat && !I.discrete) - visible_message("\red [user] misses [src] with \the [I]!") - return 0 - if(istype(I, /obj/item/weapon/butch/meatcleaver) && src.stat == DEAD && user.a_intent == "harm") var/obj/item/weapon/reagent_containers/food/snacks/meat/human/newmeat = new /obj/item/weapon/reagent_containers/food/snacks/meat/human(get_turf(src.loc)) newmeat.name = src.real_name + newmeat.name @@ -235,7 +224,7 @@ emp_act del(src) - var/datum/organ/external/affecting = get_organ(target_zone) + var/datum/organ/external/affecting = get_organ(ran_zone(user.zone_sel.selecting)) if (!affecting) return 0 if(affecting.status & ORGAN_DESTROYED) @@ -267,7 +256,7 @@ emp_act var/armor = run_armor_check(affecting, "melee", "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"))) + if ((weapon_sharp || weapon_edge) && prob(getarmor(user.zone_sel.selecting, "melee"))) weapon_sharp = 0 weapon_edge = 0 @@ -348,25 +337,13 @@ emp_act /mob/living/carbon/human/hitby(atom/movable/AM as mob|obj,var/speed = 5) if(istype(AM,/obj/)) var/obj/O = AM + var/zone = ran_zone("chest", 65) var/dtype = BRUTE if(istype(O,/obj/item/weapon)) var/obj/item/weapon/W = O dtype = W.damtype var/throw_damage = O.throwforce*(speed/5) - var/zone - if (istype(O.thrower, /mob/living)) - var/mob/living/L = O.thrower - zone = check_zone(L.zone_sel.selecting) - else - zone = ran_zone("chest",75) //Hits a random part of the body, geared towards the chest - - //check if we hit - if (O.throw_source) - var/distance = get_dist(O.throw_source, loc) - zone = get_zone_with_miss_chance(zone, src, min(15*(distance-2), 0)) - else - zone = get_zone_with_miss_chance(zone, src, 15) /* if(!zone) visible_message("\blue \The [O] misses [src] narrowly!") @@ -383,8 +360,8 @@ emp_act 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 - if(armor < 2) - apply_damage(throw_damage, dtype, zone, armor, is_sharp(O), has_edge(O), O) + + apply_damage(throw_damage, dtype, zone, armor, is_sharp(O), has_edge(O), O) if(ismob(O.thrower)) var/mob/M = O.thrower diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index f7e21bc376c..f8e171147fe 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -457,7 +457,10 @@ language = "Chittin" unarmed_type = /datum/unarmed_attack/claws - flags = IS_WHITELISTED | HAS_CHITTIN + + brute_mod = 0.8 + + flags = IS_WHITELISTED bloodflags = BLOOD_GREEN bodyflags = FEET_CLAWS diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index d35ae4ca7e9..52019fc923e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -23,7 +23,6 @@ src << "[soften_text]" else src << "Your armor softens the blow!" - world << "Armor is [armor]" return armor //if null is passed for def_zone, then this should return something appropriate for all zones (e.g. area effect damage) @@ -132,9 +131,9 @@ return */ src.visible_message("\red [src] has been hit by [O].") - var/armor = run_armor_check(null, "melee") + var/armor = run_armor_check(zone, "melee") - apply_damage(throw_damage, dtype, zone, armor, O, is_sharp(O), has_edge(O)) + apply_damage(throw_damage, dtype, zone, armor, is_sharp(O), has_edge(O), O) O.throwing = 0 //it hit, so stop moving diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 3b70fa6dc3b..5edeeb1a69a 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -172,72 +172,24 @@ proc/hasorgans(A) // If "chest" was passed in as zone, then on a "miss" will return "head", "l_arm", or "r_arm" // Do not use this if someone is intentionally trying to hit a specific body part. // Use get_zone_with_miss_chance() for that. -/proc/ran_zone(zone, probability) - zone = check_zone(zone) - if(!probability) probability = 90 - if(probability == 100) return zone +/proc/ran_zone(zone, probability = 80) - if(zone == "chest") - if(prob(probability)) return "chest" - var/t = rand(1, 9) - switch(t) - if(1 to 3) return "head" - if(4 to 6) return "l_arm" - if(7 to 9) return "r_arm" - - if(prob(probability * 0.75)) return zone - return "chest" - - -// Emulates targetting a specific body part, and miss chances -// May return null if missed -// miss_chance_mod may be negative. -/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0) zone = check_zone(zone) - // you can only miss if your target is standing and not restrained - if(!target.buckled && !target.lying) - var/miss_chance = 10 - switch(zone) - if("head") - miss_chance = 40 - if("l_leg") - miss_chance = 20 - if("r_leg") - miss_chance = 20 - if("l_arm") - miss_chance = 20 - if("r_arm") - miss_chance = 20 - if("l_hand") - miss_chance = 50 - if("r_hand") - miss_chance = 50 - if("l_foot") - miss_chance = 50 - if("r_foot") - miss_chance = 50 - miss_chance = max(miss_chance + miss_chance_mod, 0) - if(prob(miss_chance)) - if(prob(70)) - return null - else - var/t = rand(1, 10) - switch(t) - if(1) return "head" - if(2) return "l_arm" - if(3) return "r_arm" - if(4) return "chest" - if(5) return "l_foot" - if(6) return "r_foot" - if(7) return "l_hand" - if(8) return "r_hand" - if(9) return "l_leg" - if(10) return "r_leg" + if(prob(probability)) + return zone + + var/t = rand(1, 18) // randomly pick a different zone, or maybe the same one + switch(t) + if(1) return "head" + if(2) return "chest" + if(3 to 6) return "l_arm" + if(7 to 10) return "r_arm" + if(11 to 14) return "l_leg" + if(15 to 18) return "r_leg" return zone - /proc/stars(n, pr) if (pr == null) pr = 25 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 75be76b5af1..970a5c1ea1a 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -109,21 +109,8 @@ //Lower accurancy/longer range tradeoff. Distance matters a lot here, so at // close distance, actually RAISE the chance to hit. - var/distance = get_dist(starting,loc) - var/miss_modifier = -30 - if (istype(shot_from,/obj/item/weapon/gun)) //If you aim at someone beforehead, it'll hit more often. - var/obj/item/weapon/gun/daddy = shot_from //Kinda balanced by fact you need like 2 seconds to aim - if (daddy.target && original in daddy.target) //As opposed to no-delay pew pew - miss_modifier += -30 - if(istype(src, /obj/item/projectile/beam/lightning)) //Lightning is quite accurate - miss_modifier += -200 - def_zone = get_zone_with_miss_chance(def_zone, M, miss_modifier) - var/turf/simulated/floor/f = get_turf(A.loc) - if(f && istype(f)) - f.break_tile() - f.hotspot_expose(1000,CELL_VOLUME) - else - def_zone = get_zone_with_miss_chance(def_zone, M, miss_modifier + 8*distance) + var/distance = get_dist(get_turf(A), starting) // Get the distance between the turf shot from and the mob we hit and use that for the calculations. + def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use. /* if(!def_zone) visible_message("\blue \The [src] misses [M] narrowly!")