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,41 +97,56 @@
/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))
..()
return
if(!isliving(M))
var/mob/living/carbon/human/H = M
if(user.a_intent == "hurt")
if(!..()) return
H.visible_message("<span class='danger'>[M] has been beaten with the [src] by [user]!</span>")
user.attack_log += "\[[time_stamp()]\]<font color='red'> Beat [H.name] ([H.ckey]) with [src.name]</font>"
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
var/mob/living/L = M
if(user.a_intent == "harm")
..()
if(!status)
L.visible_message("<span class='warning'>[L] has been prodded with [src] by [user]. Luckily it was off.</span>")
return
var/stunroll = (rand(1,100))
if(ishuman(L) && status)
user.lastattacked = L
L.lastattacker = user
if(user == L) // Attacking yourself can't miss
if(status)
user.lastattacked = H
H.lastattacker = user
if(user == H) // Attacking yourself can't miss
stunroll = 100
if(stunroll < 40)
L.visible_message("\red <B>[user] misses [L] with \the [src]!")
msg_admin_attack("[key_name(user)] attempted to stun [key_name(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(H)] with the [src].")
return
L.Stun(stunforce)
L.Weaken(stunforce)
L.apply_effect(STUTTER, stunforce)
H.Stun(stunforce)
H.Weaken(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)
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))
var/mob/living/silicon/robot/R = loc
if(R && R.cell)