fix to allow non-humans to be stunned like they should be. Gosh. (Also, clumsy check and making harmbaton actually work)

This commit is contained in:
DJSnapshot
2014-07-25 16:56:56 -07:00
parent 36c4c226f8
commit a4fc2b04a2

View File

@@ -97,40 +97,55 @@
/obj/item/weapon/melee/baton/attack(mob/M, mob/user) /obj/item/weapon/melee/baton/attack(mob/M, mob/user)
if(status && (CLUMSY in user.mutations) && prob(50))
user << "span class='danger'>You accidentally hit yourself with the [src]!</span>"
user.Weaken(30)
deductcharge(hitcost)
return
if(isrobot(M)) if(isrobot(M))
..() ..()
return return
if(!isliving(M))
return
var/mob/living/L = M var/mob/living/carbon/human/H = M
if(user.a_intent == "harm") if(user.a_intent == "hurt")
..() if(!..()) return
H.visible_message("<span class='danger'>[M] has been beaten with the [src] by [user]!</span>")
if(!status) user.attack_log += "\[[time_stamp()]\]<font color='red'> Beat [H.name] ([H.ckey]) with [src.name]</font>"
L.visible_message("<span class='warning'>[L] has been prodded with [src] by [user]. Luckily it was off.</span>") H.attack_log += "\[[time_stamp()]\]<font color='orange'> Beaten by [user.name] ([user.ckey]) with [src.name]</font>"
msg_admin_attack("[user.name] ([user.ckey]) beat [H.name] ([H.ckey]) with [src.name] (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
playsound(src.loc, "swing_hit", 50, 1, -1)
else if(!status)
H.visible_message("<span class='warning'>[H] has been prodded with [src] by [user]. Luckily it was off.</span>")
return return
var/stunroll = (rand(1,100)) var/stunroll = (rand(1,100))
if(ishuman(L) && status) if(status)
user.lastattacked = L user.lastattacked = H
L.lastattacker = user H.lastattacker = user
if(user == L) // Attacking yourself can't miss if(user == H) // Attacking yourself can't miss
stunroll = 100 stunroll = 100
if(stunroll < 40) if(stunroll < 40)
L.visible_message("\red <B>[user] misses [L] with \the [src]!") H.visible_message("\red <B>[user] misses [H] with \the [src]!")
msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].") msg_admin_attack("[key_name(user)] attempted to stun [key_name(H)] with the [src].")
return return
L.Stun(stunforce) H.Stun(stunforce)
L.Weaken(stunforce) H.Weaken(stunforce)
L.apply_effect(STUTTER, stunforce) H.apply_effect(STUTTER, stunforce)
L.visible_message("<span class='danger'>[L] has been stunned with [src] by [user]!</span>") H.visible_message("<span class='danger'>[H] has been stunned with [src] by [user]!</span>")
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
msg_admin_attack("[key_name(user)] stunned [key_name(L)] with the [src].") msg_admin_attack("[key_name(user)] stunned [key_name(H)] with the [src].")
user.attack_log += "\[[time_stamp()]\]<font color='red'> Stunned [H.name] ([H.ckey]) with [src.name]</font>"
H.attack_log += "\[[time_stamp()]\]<font color='orange'> Stunned by [user.name] ([user.ckey]) with [src.name]</font>"
if(isrobot(loc)) if(isrobot(loc))
var/mob/living/silicon/robot/R = loc var/mob/living/silicon/robot/R = loc