mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Aggressive grab auto hit only applies to close targets and melee attacks
This commit is contained in:
@@ -319,7 +319,7 @@ emp_act
|
||||
if (O.throw_source)
|
||||
var/distance = get_dist(O.throw_source, loc)
|
||||
miss_chance = max(15*(distance-2), 0)
|
||||
zone = get_zone_with_miss_chance(zone, src, miss_chance)
|
||||
zone = get_zone_with_miss_chance(zone, src, miss_chance, ranged_attack=1)
|
||||
|
||||
if(!zone)
|
||||
visible_message("\blue \The [O] misses [src] narrowly!")
|
||||
|
||||
@@ -229,16 +229,17 @@ var/list/global/organ_rel_size = list(
|
||||
// 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)
|
||||
/proc/get_zone_with_miss_chance(zone, var/mob/target, var/miss_chance_mod = 0, var/ranged_attack=0)
|
||||
zone = check_zone(zone)
|
||||
|
||||
// you cannot miss if your target is prone or restrained
|
||||
if(target.buckled || target.lying)
|
||||
return zone
|
||||
// if your target is being grabbed aggressively by someone you cannot miss either
|
||||
for(var/obj/item/weapon/grab/G in target.grabbed_by)
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
return zone
|
||||
if(!ranged_attack)
|
||||
for(var/obj/item/weapon/grab/G in target.grabbed_by)
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
return zone
|
||||
|
||||
var/miss_chance = 10
|
||||
if (zone in base_miss_chance)
|
||||
|
||||
@@ -135,16 +135,21 @@
|
||||
xo = new_x - starting_loc.x
|
||||
|
||||
//Called when the projectile intercepts a mob. Returns 1 if the projectile hit the mob, 0 if it missed and should keep flying.
|
||||
/obj/item/projectile/proc/attack_mob(var/mob/living/target_mob, var/distance, var/miss_modifier)
|
||||
/obj/item/projectile/proc/attack_mob(var/mob/living/target_mob, var/distance, var/miss_modifier=0)
|
||||
//accuracy bonus from aiming
|
||||
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 (istype(shot_from, /obj/item/weapon/gun))
|
||||
var/obj/item/weapon/gun/daddy = shot_from
|
||||
miss_modifier -= round(15*daddy.accuracy)
|
||||
if (daddy.aim_targets && original in daddy.aim_targets) //As opposed to no-delay pew pew
|
||||
|
||||
//If you aim at someone beforehead, it'll hit more often.
|
||||
//Kinda balanced by fact you need like 2 seconds to aim
|
||||
//As opposed to no-delay pew pew
|
||||
if (daddy.aim_targets && original in daddy.aim_targets)
|
||||
miss_modifier += -30
|
||||
|
||||
//roll to-hit
|
||||
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, max(miss_modifier + 15*(distance-2), 0))
|
||||
miss_modifier = max(miss_modifier + 15*(distance-2), 0)
|
||||
var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1))
|
||||
if(!hit_zone)
|
||||
visible_message("<span class='notice'>\The [src] misses [target_mob] narrowly!</span>")
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user