mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-22 12:47:16 +01:00
@@ -409,7 +409,12 @@ var/list/global/slot_flags_enumeration = list(
|
||||
/obj/item/proc/ui_action_click()
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/proc/IsShield()
|
||||
//RETURN VALUES
|
||||
//handle_shield should return a positive value to indicate that the attack is blocked and should be prevented.
|
||||
//If a negative value is returned, it should be treated as a special return value for bullet_act() and handled appropriately.
|
||||
//For non-projectile attacks this usually means the attack is blocked.
|
||||
//Otherwise should return 0 to indicate that the attack is not affected in any way.
|
||||
/obj/item/proc/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
return 0
|
||||
|
||||
/obj/item/proc/get_loc_turf()
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
||||
hitsound = 'sound/weapons/bladeslice.ogg'
|
||||
|
||||
/obj/item/weapon/material/sword/IsShield()
|
||||
return 1
|
||||
/obj/item/weapon/material/sword/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
|
||||
if(default_parry_check(user, attacker, damage_source) && prob(50))
|
||||
user.visible_message("<span class='danger'>\The [user] parries [attack_text] with \the [src]!</span>")
|
||||
playsound(user.loc, 'sound/weapons/punchmiss.ogg', 50, 1)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/material/sword/suicide_act(mob/user)
|
||||
viewers(user) << "<span class='danger'>[user] is falling on the [src.name]! It looks like \he's trying to commit suicide.</span>"
|
||||
|
||||
@@ -71,6 +71,14 @@
|
||||
O.unwield()
|
||||
return unwield()
|
||||
|
||||
//Allow a small chance of parrying melee attacks when wielded - maybe generalize this to other weapons someday
|
||||
/obj/item/weapon/material/twohanded/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
if(wielded && default_parry_check(user, attacker, damage_source) && prob(15))
|
||||
user.visible_message("<span class='danger'>\The [user] parries [attack_text] with \the [src]!</span>")
|
||||
playsound(user.loc, 'sound/weapons/punchmiss.ogg', 50, 1)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/material/twohanded/update_icon()
|
||||
icon_state = "[base_icon][wielded]"
|
||||
item_state = icon_state
|
||||
@@ -167,51 +175,7 @@
|
||||
else if(istype(A,/obj/effect/plant))
|
||||
var/obj/effect/plant/P = A
|
||||
P.die_off()
|
||||
|
||||
/*
|
||||
/*
|
||||
* Double-Bladed Energy Swords - Cheridan
|
||||
*/
|
||||
// Not sure what to do with this one, it won't work nicely with the material system,
|
||||
// but I don't want to copypaste all the twohanded procs..
|
||||
/obj/item/weapon/material/twohanded/dualsaber
|
||||
icon_state = "dualsaber0"
|
||||
base_icon = "dualsaber"
|
||||
name = "double-bladed energy sword"
|
||||
desc = "Handle with care."
|
||||
force = 3
|
||||
throwforce = 5.0
|
||||
throw_speed = 1
|
||||
throw_range = 5
|
||||
w_class = 2.0
|
||||
force_wielded = 30
|
||||
wieldsound = 'sound/weapons/saberon.ogg'
|
||||
unwieldsound = 'sound/weapons/saberoff.ogg'
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_ILLEGAL = 4)
|
||||
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
|
||||
sharp = 1
|
||||
edge = 1
|
||||
applies_material_colour = 0
|
||||
|
||||
/obj/item/weapon/material/twohanded/dualsaber/attack(target as mob, mob/living/user as mob)
|
||||
..()
|
||||
if((CLUMSY in user.mutations) && (wielded) &&prob(40))
|
||||
user << "<span class='danger'>You twirl around a bit before losing your balance and impaling yourself on \the [src].</span>"
|
||||
user.take_organ_damage(20,25)
|
||||
return
|
||||
if((wielded) && prob(50))
|
||||
spawn(0)
|
||||
for(var/i in list(1,2,4,8,4,2,1,2,4,8,4,2))
|
||||
user.set_dir(i)
|
||||
sleep(1)
|
||||
|
||||
/obj/item/weapon/material/twohanded/dualsaber/IsShield()
|
||||
if(wielded)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
*/
|
||||
|
||||
|
||||
//spears, bay edition
|
||||
/obj/item/weapon/material/twohanded/spear
|
||||
icon_state = "spearglass0"
|
||||
|
||||
@@ -151,8 +151,14 @@
|
||||
attack_verb = list()
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
/obj/item/weapon/melee/energy/sword/IsShield()
|
||||
if(active)
|
||||
/obj/item/weapon/melee/energy/sword/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
if(active && default_parry_check(user, attacker, damage_source) && 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
|
||||
|
||||
|
||||
@@ -1,5 +1,52 @@
|
||||
//** Shield Helpers
|
||||
//These are shared by various items that have shield-like behaviour
|
||||
|
||||
//bad_arc is the ABSOLUTE arc of directions from which we cannot block. If you want to fix it to e.g. the user's facing you will need to rotate the dirs yourself.
|
||||
/proc/check_shield_arc(mob/user, var/bad_arc, atom/damage_source = null, mob/attacker = null)
|
||||
//check attack direction
|
||||
var/attack_dir = 0 //direction from the user to the source of the attack
|
||||
if(istype(damage_source, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = damage_source
|
||||
attack_dir = get_dir(get_turf(user), P.starting)
|
||||
else if(attacker)
|
||||
attack_dir = get_dir(get_turf(user), get_turf(attacker))
|
||||
else if(damage_source)
|
||||
attack_dir = get_dir(get_turf(user), get_turf(damage_source))
|
||||
|
||||
if(!(attack_dir && (attack_dir & bad_arc)))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/default_parry_check(mob/user, mob/attacker, atom/damage_source)
|
||||
//parry only melee attacks
|
||||
if(istype(damage_source, /obj/item/projectile) || (attacker && get_dist(user, attacker) > 1) || user.incapacitated())
|
||||
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
|
||||
|
||||
return 1
|
||||
|
||||
/obj/item/weapon/shield
|
||||
name = "shield"
|
||||
var/base_block_chance = 50
|
||||
|
||||
/obj/item/weapon/shield/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
|
||||
if(user.incapacitated())
|
||||
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))
|
||||
if(prob(get_block_chance(user, damage, damage_source, attacker)))
|
||||
user.visible_message("<span class='danger'>\The [user] blocks [attack_text] with \the [src]!</span>")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/shield/proc/get_block_chance(mob/user, var/damage, atom/damage_source = null, mob/attacker = null)
|
||||
return base_block_chance
|
||||
|
||||
/obj/item/weapon/shield/riot
|
||||
name = "riot shield"
|
||||
@@ -18,17 +65,26 @@
|
||||
attack_verb = list("shoved", "bashed")
|
||||
var/cooldown = 0 //shield bash cooldown. based on world.time
|
||||
|
||||
IsShield()
|
||||
return 1
|
||||
/obj/item/weapon/shield/riot/handle_shield(mob/user)
|
||||
. = ..()
|
||||
if(.) playsound(user.loc, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/melee/baton))
|
||||
if(cooldown < world.time - 25)
|
||||
user.visible_message("<span class='warning'>[user] bashes [src] with [W]!</span>")
|
||||
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1)
|
||||
cooldown = world.time
|
||||
else
|
||||
..()
|
||||
/obj/item/weapon/shield/riot/get_block_chance(mob/user, var/damage, atom/damage_source = null, mob/attacker = null)
|
||||
if(istype(damage_source, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = damage_source
|
||||
//plastic shields do not stop bullets or lasers, even in space. Will block beanbags, rubber bullets, and stunshots just fine though.
|
||||
if((is_sharp(P) && damage > 10) || istype(P, /obj/item/projectile/beam))
|
||||
return 0
|
||||
return base_block_chance
|
||||
|
||||
/obj/item/weapon/shield/riot/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/melee/baton))
|
||||
if(cooldown < world.time - 25)
|
||||
user.visible_message("<span class='warning'>[user] bashes [src] with [W]!</span>")
|
||||
playsound(user.loc, 'sound/effects/shieldbash.ogg', 50, 1)
|
||||
cooldown = world.time
|
||||
else
|
||||
..()
|
||||
|
||||
/*
|
||||
* Energy Shield
|
||||
@@ -49,11 +105,23 @@
|
||||
attack_verb = list("shoved", "bashed")
|
||||
var/active = 0
|
||||
|
||||
/obj/item/weapon/shield/energy/IsShield()
|
||||
if(active)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
/obj/item/weapon/shield/energy/handle_shield(mob/user)
|
||||
if(!active)
|
||||
return 0 //turn it on first!
|
||||
. = ..()
|
||||
|
||||
if(.)
|
||||
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)
|
||||
|
||||
/obj/item/weapon/shield/energy/get_block_chance(mob/user, var/damage, atom/damage_source = null, mob/attacker = null)
|
||||
if(istype(damage_source, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = damage_source
|
||||
if((is_sharp(P) && damage > 10) || istype(P, /obj/item/projectile/beam))
|
||||
return (base_block_chance - round(damage / 3)) //block bullets and beams using the old block chance
|
||||
return base_block_chance
|
||||
|
||||
/obj/item/weapon/shield/energy/attack_self(mob/living/user as mob)
|
||||
if ((CLUMSY in user.mutations) && prob(50))
|
||||
@@ -82,9 +150,10 @@
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/weapon/cloaking_device
|
||||
name = "cloaking device"
|
||||
desc = "Use this to become invisible to the human eyesocket."
|
||||
desc = "Use this to become invisible to the human eye."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "shield0"
|
||||
var/active = 0.0
|
||||
@@ -114,3 +183,4 @@
|
||||
if(ismob(loc))
|
||||
loc:update_icons()
|
||||
..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user