Added a mechanic that makes it possible to miss in melee.

Only happens when the target is neither laying nor restrained. In this case, there are various chances to miss the targetted organ, and either hit nothing, or a different organ.
This commit is contained in:
cib
2012-12-19 20:40:29 +01:00
parent 1d0147c396
commit 596d944414
2 changed files with 51 additions and 1 deletions

View File

@@ -113,7 +113,11 @@ 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/datum/organ/external/affecting = get_organ(ran_zone(user.zone_sel.selecting))
var/target_zone = get_zone_with_miss_chance(user.zone_sel.selecting)
if(!target_zone)
visible_message("\red <B>[user] misses [src] with \the [I]!")
var/datum/organ/external/affecting = get_organ(target_zone)
if (!affecting)
return
if(affecting.status & ORGAN_DESTROYED)

View File

@@ -163,6 +163,52 @@ proc/hasorgans(A)
if(prob(probability * 0.75)) return zone
return "chest"
// Emulates targetting a specific body part, and miss chances
// May return null if missed
/proc/get_zone_with_miss_chance(zone, var/mob/target)
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
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"
return zone
/proc/stars(n, pr)
if (pr == null)