diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 2e497863a6..b64a109dff 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -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]!" + 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("[M] has been beaten with the [src] by [user]!") + + user.attack_log += "\[[time_stamp()]\] Beat [H.name] ([H.ckey]) with [src.name]" + H.attack_log += "\[[time_stamp()]\] Beaten by [user.name] ([user.ckey]) with [src.name]" + msg_admin_attack("[user.name] ([user.ckey]) beat [H.name] ([H.ckey]) with [src.name] (JMP)") + + playsound(src.loc, "swing_hit", 50, 1, -1) + + else if(!status) + H.visible_message("[H] has been prodded with [src] by [user]. Luckily it was off.") return - var/mob/living/L = M - - if(user.a_intent == "harm") - ..() - - if(!status) - L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.") - 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 [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 [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("[L] has been stunned with [src] by [user]!") + H.visible_message("[H] has been stunned with [src] by [user]!") 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()]\] Stunned [H.name] ([H.ckey]) with [src.name]" + H.attack_log += "\[[time_stamp()]\] Stunned by [user.name] ([user.ckey]) with [src.name]" + if(isrobot(loc)) var/mob/living/silicon/robot/R = loc if(R && R.cell)