From 7ee2b8f79ea33925d967d6e7b05a19982656f0da Mon Sep 17 00:00:00 2001 From: cib Date: Thu, 22 Mar 2012 14:53:29 -0800 Subject: [PATCH] Added a swing mechanic. --- code/game/objects/items/item.dm | 27 ++++++++++++++----- .../mob/living/carbon/human/human_defense.dm | 2 +- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index 621352351c4..c3f621de6b0 100755 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -259,6 +259,26 @@ mob/proc/flash_weak_pain() user.lastattacked = M M.lastattacker = user + var/power = src.force + + // EXPERIMENTAL: scale power and time to the weight class + if(w_class >= 4.0 && !istype(src,/obj/item/weapon/melee/energy/blade)) // eswords are an exception, they only have a w_class of 4 to not fit into pockets + power = power * 2.5 + + user.visible_message("\red [user.name] swings at [M.name] with \the [src]!") + user.next_move = max(user.next_move, world.time + 30) + + // if the mob didn't move, he has a 100% chance to hit(given the enemy also didn't move) + // otherwise, the chance to hit is lower + var/unmoved = 0 + spawn + unmoved = do_after(user, 4) + sleep(4) + if( (!unmoved && !prob(70)) || get_dist(user, M) != 1) + user.visible_message("\red [user.name] misses with \the [src]!") + return + + user.attack_log += "\[[time_stamp()]\] Attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" M.attack_log += "\[[time_stamp()]\] Attacked by [user.name] ([user.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])" log_admin("ATTACK: [user] ([user.ckey]) attacked [M] ([M.ckey]) with [src].") @@ -268,13 +288,6 @@ mob/proc/flash_weak_pain() // M.lastattacker = null ///////////////////////// - var/power = src.force - - // EXPERIMENTAL: scale power and time to the weight class - if(w_class >= 4.0) - power = power * 2 - user.next_move = max(user.next_move, world.time + 20) - if(!istype(M, /mob/living/carbon/human)) if(istype(M, /mob/living/carbon/metroid)) var/mob/living/carbon/metroid/Metroid = M diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 3f43ffc3548..223c38582b3 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -107,7 +107,7 @@ emp_act apply_damage(, I.damtype, affecting, armor, is_cut(I), I.name) var/bloody = 0 - if((I.damtype == BRUTE) && prob(25 + (I.force * 2))) + if((I.damtype == BRUTE) && prob(25 + is_sharp(I) * 50 + (I.force * 2))) I.add_blood(src) bloody = 1 var/turf/location = loc