mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
Fixed two issues with bullet hit chance.
- Bullet hit chance was too low at close distance - Missing wouldn't actually prevent the damage
This commit is contained in:
@@ -165,12 +165,13 @@ proc/hasorgans(A)
|
|||||||
|
|
||||||
// Emulates targetting a specific body part, and miss chances
|
// Emulates targetting a specific body part, and miss chances
|
||||||
// May return null if missed
|
// 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)
|
/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0)
|
||||||
zone = check_zone(zone)
|
zone = check_zone(zone)
|
||||||
|
|
||||||
// you can only miss if your target is standing and not restrained
|
// you can only miss if your target is standing and not restrained
|
||||||
if(!target.buckled && !target.lying)
|
if(!target.buckled && !target.lying)
|
||||||
var/miss_chance = 10 + miss_chance_mod
|
var/miss_chance = max(10 + miss_chance_mod, 0)
|
||||||
switch(zone)
|
switch(zone)
|
||||||
if("head")
|
if("head")
|
||||||
miss_chance = 40
|
miss_chance = 40
|
||||||
|
|||||||
@@ -80,11 +80,13 @@
|
|||||||
forcedodge = 1
|
forcedodge = 1
|
||||||
else
|
else
|
||||||
var/distance = get_dist(original,loc)
|
var/distance = get_dist(original,loc)
|
||||||
//Lower accurancy/longer range tradeoff.
|
//Lower accurancy/longer range tradeoff. Distance matters a lot here, so at
|
||||||
def_zone = get_zone_with_miss_chance(def_zone, src, 3*distance)
|
// close distance, actually RAISE the chance to hit.
|
||||||
|
def_zone = get_zone_with_miss_chance(def_zone, src, -30 + 8*distance)
|
||||||
|
|
||||||
if(!def_zone)
|
if(!def_zone)
|
||||||
visible_message("\The [src] misses [M] narrowly.")
|
visible_message("\The [src] misses [M] narrowly.")
|
||||||
|
return
|
||||||
if(silenced)
|
if(silenced)
|
||||||
M << "\red You've been shot in the [def_zone] by the [src.name]!"
|
M << "\red You've been shot in the [def_zone] by the [src.name]!"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user