From 0dc07bafa1acdf865b76a5bf33fc1551acf819bc Mon Sep 17 00:00:00 2001 From: mwerezak Date: Thu, 31 Jul 2014 13:39:06 -0400 Subject: [PATCH] Stun baton nerf Adds agonyforce var to stun batons, which causes halloss and eye blur. Also did some clean up of stun batons, and fixed the stun baton's bcell var being of type weapon/cell/high instead of weapon/cell. Conflicts: code/_onclick/item_attack.dm code/game/objects/items/weapons/stunbaton.dm --- code/_onclick/item_attack.dm | 7 +- code/game/objects/items/weapons/stunbaton.dm | 133 ++++++++++-------- .../mob/living/silicon/robot/robot_modules.dm | 2 +- 3 files changed, 81 insertions(+), 61 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index d570dd152e8..07fb74b8359 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -24,13 +24,12 @@ /obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone) if (!istype(M)) // not sure if this is the right thing... - return + return 0 var/messagesource = M if (can_operate(M)) //Checks if mob is lying down on table for surgery if (do_surgery(M,user,src)) - return - + return 0 if (istype(M,/mob/living/carbon/brain)) messagesource = M:container if (hitsound && force > 0) @@ -145,7 +144,7 @@ if(istype(M, /mob/living/carbon/human)) - return M:attacked_by(src, user, def_zone) + return M:attacked_by(src, user, def_zone) //make sure to return whether we have hit or miss else switch(damtype) if("brute") diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 3ca5e3ca4ba..20909228642 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -8,21 +8,23 @@ force = 10 throwforce = 7 w_class = 3 - var/stunforce = 10 - var/status = 0 - var/mob/foundmob = "" //Used in throwing proc. - var/obj/item/weapon/cell/high/bcell = 0 - var/hitcost = 1500 - origin_tech = "combat=2" + attack_verb = list("beaten") + var/stunforce = 0 + var/agonyforce = 60 + var/status = 0 //whether the thing is on or not + var/obj/item/weapon/cell/high/bcell = null + var/mob/foundmob = "" //Used in throwing proc. + var/hitcost = 1500 //oh god why do power cells carry so much charge? We probably need to make a distinction between "industrial" sized power cells for APCs and power cells for everything else. - suicide_act(mob/user) - viewers(user) << "[user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide." - return (FIRELOSS) +/obj/item/weapon/melee/baton/suicide_act(mob/user) + user.visible_message("[user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide.") + return (FIRELOSS) -/obj/item/weapon/melee/baton/loaded/New() + +/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed. ..() - bcell = new(src) + bcell = new/obj/item/weapon/cell/high(src) update_icon() return @@ -116,51 +118,60 @@ ..() return - var/mob/living/carbon/human/H = M + var/agony = agonyforce + var/mob/living/L = M - if(user.a_intent == "hurt") - if(!..()) return - H.visible_message("[M] has been beaten with the [src] by [user]!") + var/contact = 1 + if(user.a_intent == "harm") + contact = ..() + agony *= 0.5 //whacking someone causes a much poorer contact than prodding them. + else + //copied from human_defense.dm + if (ishuman(L)) + user.lastattacked = L //are these used at all, if we have logs? + L.lastattacker = 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)") + var/target_zone = get_zone_with_miss_chance(user.zone_sel.selecting, L) + if(user == L) // Attacking yourself can't miss + target_zone = user.zone_sel.selecting + if(!target_zone) + contact = 0 + else + switch (target_zone) + if("head") + agony *= 1.25 + //if("l_hand", "r_hand") //TODO + //if("l_foot", "r_foot") //TODO - 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/stunroll = (rand(1,100)) - - if(status) - user.lastattacked = H - H.lastattacker = user - if(user == H) // Attacking yourself can't miss - stunroll = 100 - if(stunroll < 40) - 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 - H.Stun(stunforce) - H.Weaken(stunforce) - H.apply_effect(STUTTER, stunforce) - - 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(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) - R.cell.use(hitcost) + //put this here to avoid duplicate messages and logs from ..() above + if (!contact) + L.visible_message("\red [user] misses [L] with \the [src]!") else - deductcharge(hitcost) + if(!status) + L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.") + else + L.visible_message("[L] has been prodded with [src] by [user]!") + msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].") + + //stun effects + if (contact) + if (stunforce) + L.Stun(stunforce) + L.Weaken(stunforce) + L.apply_effect(STUTTER, stunforce) + + if (agony) + //Siemens coefficient? + //TODO: Merge this with taser effects + L.apply_effect(agony,AGONY,0) + L.apply_effect(STUTTER, agony/10) + L.apply_effect(EYE_BLUR, agony/10) + L.flash_pain() + + playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1) + msg_admin_attack("[key_name(user)] stunned [key_name(L)] with the [src].") + + deductcharge(hitcost) /obj/item/weapon/melee/baton/throw_impact(atom/hit_atom) @@ -196,11 +207,19 @@ /obj/item/weapon/melee/baton/emp_act(severity) if(bcell) - deductcharge(1000 / severity) - if(bcell.reliability != 100 && prob(50/severity)) - bcell.reliability -= 10 / severity + bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please. ..() +//secborg stun baton module +/obj/item/weapon/melee/baton/robot/attack_self(mob/user) + //try to find our power cell + var/mob/living/silicon/robot/R = loc + if (istype(R)) + bcell = R.cell + return ..() + +/obj/item/weapon/melee/baton/robot/attackby(obj/item/weapon/W, mob/user) + return /obj/item/weapon/melee/baton/loaded/ntcane name = "fancy cane" @@ -216,8 +235,10 @@ item_state = "prod" force = 3 throwforce = 5 - stunforce = 5 + stunforce = 0 + agonyforce = 60 //same force as a stunbaton, but uses way more charge. hitcost = 2500 + attack_verb = list("poked") slot_flags = null /obj/item/weapon/melee/baton/cattleprod/update_icon() diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 5dbbad2a3b2..4a939b964d8 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -232,7 +232,7 @@ src.modules += new /obj/item/device/flash(src) src.modules += new /obj/item/borg/sight/hud/sec(src) src.modules += new /obj/item/weapon/handcuffs/cyborg(src) - src.modules += new /obj/item/weapon/melee/baton/loaded(src) + src.modules += new /obj/item/weapon/melee/baton/robot(src) src.modules += new /obj/item/weapon/gun/energy/taser/cyborg(src) src.modules += new /obj/item/taperoll/police(src) src.emag = new /obj/item/weapon/gun/energy/laser/cyborg(src)