From e7718541d6248b30bd30e4a6b226cd5916e4a02e Mon Sep 17 00:00:00 2001 From: Giacomand Date: Wed, 10 Jul 2013 09:35:07 +0100 Subject: [PATCH 1/2] Changed the projectile code to have a lower probability to hit your target area the further away you are, instead of the further the original target was. This is more logical and makes sense. I also changed how it decides which zone to hit instead, if the random check fails. Fixes #922 --- code/modules/mob/mob_helpers.dm | 23 +++++++++++++---------- code/modules/projectiles/projectile.dm | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index ec3a2e2de24..9072a238fde 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -149,18 +149,21 @@ proc/isorgan(A) /proc/ran_zone(zone, probability) zone = check_zone(zone) if(!probability) probability = 90 - if(probability == 100) return zone + if(probability <= 100) + return zone - 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)) + return zone + var/t = rand(1, 17) + 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(10 to 13) return "l_leg" + if(14 to 17) return "r_leg" - if(prob(probability * 0.75)) return zone - return "chest" + return zone /proc/stars(n, pr) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index c149e8abe33..6b2eb98b454 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -78,8 +78,8 @@ loc = A.loc return 0// nope.avi - var/distance = get_dist(original,loc) - def_zone = ran_zone(def_zone, 100-(5*distance)) //Lower accurancy/longer range tradeoff. + 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(silenced) M << "You've been shot in the [parse_zone(def_zone)] by [src]!" else From 7601500650ad414a8f8afae47fdfeab34cd0f299 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Wed, 24 Jul 2013 22:11:49 +0100 Subject: [PATCH 2/2] * Cleaned up the ran_zone proc. --- code/modules/mob/mob_helpers.dm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 9072a238fde..a678e44e459 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -146,15 +146,14 @@ proc/isorgan(A) return zone -/proc/ran_zone(zone, probability) +/proc/ran_zone(zone, probability = 80) + zone = check_zone(zone) - if(!probability) probability = 90 - if(probability <= 100) - return zone if(prob(probability)) return zone - var/t = rand(1, 17) + + var/t = rand(1, 17) // randomly pick a different zone, or maybe the same one switch(t) if(1) return "head" if(2) return "chest"