Added a swing mechanic.

This commit is contained in:
cib
2012-03-22 14:53:29 -08:00
parent 5a563b4af7
commit 7ee2b8f79e
2 changed files with 21 additions and 8 deletions
+20 -7
View File
@@ -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()]\]<font color='red'> Attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])</font>"
M.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)])</font>"
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