Rewrites shield handling

Rewrites shield handling to be less hardcoded.
Shields now take into account the damage source and direction when blocking.
Riot shields no longer block most bullets, but are better at blocking melee and thrown items than they were previously.
Energy shields block projectiles with a similar probability as they did before, and block melee and thrown as well as riot shields do.
Shields no longer block from directly behind the player.
Weapons now only block melee attacks.
Cool effects when blocking with an energy shield or energy sword (including holoswords).
This commit is contained in:
mwerezak
2015-07-11 18:14:16 -04:00
parent 3cf542e5f1
commit 0a751322e3
10 changed files with 180 additions and 102 deletions

View File

@@ -252,8 +252,26 @@
New()
item_color = "red"
/obj/item/weapon/holo/esword/IsShield()
if(active)
/obj/item/weapon/holo/esword/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/attack_text = "the attack")
if(!active)
return 0
//parry only melee holo attacks
if(!istype(damage_source, /obj/item/weapon/holo) || (attacker && get_dist(user, attacker) > 1))
return 0
//block as long as they are not directly behind us
var/bad_arc = reverse_direction(user.dir) //arc of directions from which we cannot block
if(!check_shield_arc(user, bad_arc, damage_source, attacker))
return 0
if(prob(50))
user.visible_message("<span class='danger'>\The [user] parries [attack_text] with \the [src]!</span>")
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
spark_system.set_up(5, 0, user.loc)
spark_system.start()
playsound(user.loc, 'sound/weapons/blade1.ogg', 50, 1)
return 1
return 0