mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Cleave changes, attack code cleanup
This commit is contained in:
@@ -28,20 +28,20 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
return
|
||||
|
||||
//I would prefer to rename this to attack(), but that would involve touching hundreds of files.
|
||||
/obj/item/proc/resolve_attackby(atom/A, mob/user)
|
||||
/obj/item/proc/resolve_attackby(atom/A, mob/user, var/attack_modifier = 1)
|
||||
pre_attack(A, user)
|
||||
add_fingerprint(user)
|
||||
return A.attackby(src, user)
|
||||
return A.attackby(src, user, attack_modifier)
|
||||
|
||||
// No comment
|
||||
/atom/proc/attackby(obj/item/W, mob/user)
|
||||
/atom/proc/attackby(obj/item/W, mob/user, var/attack_modifier)
|
||||
return
|
||||
|
||||
/atom/movable/attackby(obj/item/W, mob/user)
|
||||
/atom/movable/attackby(obj/item/W, mob/user, var/attack_modifier)
|
||||
if(!(W.flags & NOBLUDGEON))
|
||||
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
|
||||
|
||||
/mob/living/attackby(obj/item/I, mob/user)
|
||||
/mob/living/attackby(obj/item/I, mob/user, var/attack_modifier)
|
||||
if(!ismob(user))
|
||||
return 0
|
||||
if(can_operate(src) && I.do_surgery(src,user))
|
||||
@@ -49,7 +49,7 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
return I.attack(src, user, user.zone_sel.selecting)
|
||||
return I.attack(src, user, user.zone_sel.selecting, attack_modifier)
|
||||
|
||||
// Used to get how fast a mob should attack, and influences click delay.
|
||||
// This is just for inheritence.
|
||||
@@ -73,7 +73,7 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
return
|
||||
|
||||
//I would prefer to rename this attack_as_weapon(), but that would involve touching hundreds of files.
|
||||
/obj/item/proc/attack(mob/living/M, mob/living/user, var/target_zone)
|
||||
/obj/item/proc/attack(mob/living/M, mob/living/user, var/target_zone, var/attack_modifier)
|
||||
if(!force || (flags & NOBLUDGEON))
|
||||
return 0
|
||||
if(M == user && user.a_intent != I_HURT)
|
||||
@@ -92,12 +92,12 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
|
||||
var/hit_zone = M.resolve_item_attack(src, user, target_zone)
|
||||
if(hit_zone)
|
||||
apply_hit_effect(M, user, hit_zone)
|
||||
apply_hit_effect(M, user, hit_zone, attack_modifier)
|
||||
|
||||
return 1
|
||||
|
||||
//Called when a weapon is used to make a successful melee attack on a mob. Returns the blocked result
|
||||
/obj/item/proc/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
|
||||
/obj/item/proc/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone, var/attack_modifier)
|
||||
user.break_cloak()
|
||||
if(hitsound)
|
||||
playsound(loc, hitsound, 50, 1, -1)
|
||||
@@ -106,7 +106,10 @@ avoid code duplication. This includes items that may sometimes act as a standard
|
||||
for(var/datum/modifier/M in user.modifiers)
|
||||
if(!isnull(M.outgoing_melee_damage_percent))
|
||||
power *= M.outgoing_melee_damage_percent
|
||||
|
||||
if(HULK in user.mutations)
|
||||
power *= 2
|
||||
return target.hit_with_weapon(src, user, power, hit_zone)
|
||||
|
||||
power *= attack_modifier
|
||||
|
||||
return target.hit_with_weapon(src, user, power, hit_zone)
|
||||
Reference in New Issue
Block a user