Merge pull request #4929 from Fox-McCloud/hit-reactions

Hit reactions
This commit is contained in:
TheDZD
2016-07-09 18:30:37 -04:00
committed by GitHub
42 changed files with 465 additions and 233 deletions
+9 -3
View File
@@ -57,6 +57,9 @@
var/flags_size = 0 //flag, primarily used for clothing to determine if a fatty can wear something or not.
var/block_chance = 0
var/hit_reaction_chance = 0 //If you want to have something unrelated to blocking/armour piercing etc. Maybe not needed, but trying to think ahead/allow more freedom
/* Species-specific sprites, concept stolen from Paradise//vg/.
ex:
sprite_sheets = list(
@@ -282,6 +285,12 @@
return
/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(prob(final_block_chance))
owner.visible_message("<span class='danger'>[owner] blocks [attack_text] with [src]!</span>")
return 1
return 0
/obj/item/proc/talk_into(mob/M as mob, var/text, var/channel=null)
return
@@ -374,9 +383,6 @@
/obj/item/proc/ui_action_click()
attack_self(usr)
/obj/item/proc/IsShield()
return 0
/obj/item/proc/IsReflect(var/def_zone) //This proc determines if and at what% an object will reflect energy projectiles if it's in l_hand,r_hand or wear_suit
return 0
+1 -2
View File
@@ -141,7 +141,6 @@
item_state = "sword0"
var/active = 0.0
w_class = 2.0
flags = NOSHIELD
attack_verb = list("attacked", "struck", "hit")
/obj/item/toy/sword/attack_self(mob/user as mob)
@@ -199,7 +198,7 @@
origin_tech = null
attack_verb = list("attacked", "struck", "hit")
/obj/item/weapon/twohanded/dualsaber/toy/IsShield()
/obj/item/weapon/twohanded/dualsaber/toy/hit_reaction()
return 0
/obj/item/weapon/twohanded/dualsaber/toy/IsReflect()//Stops Toy Dualsabers from reflecting energy projectiles
@@ -14,7 +14,6 @@
throw_range = 5
w_class = 2
w_class_on = 2
flags = NOSHIELD
attack_verb = list("attacked", "slashed", "gored", "sliced", "torn", "ripped", "butchered", "cut")
attack_verb_on = list()
@@ -191,10 +191,10 @@
return
/obj/item/weapon/flamethrower/proc/ignite_turf(turf/target)
/obj/item/weapon/flamethrower/proc/ignite_turf(turf/target, release_amount = 0.05)
//TODO: DEFERRED Consider checking to make sure tank pressure is high enough before doing this...
//Transfer 5% of current tank air contents to turf
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(0.05)
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount)
air_transfer.toxins = air_transfer.toxins * 5 // This is me not comprehending the air system. I realize this is retarded and I could probably make it work without fucking it up like this, but there you have it. -- TLE
target.assume_air(air_transfer)
//Burn it based on transfered gas
@@ -218,4 +218,12 @@
/obj/item/weapon/flamethrower/full/tank/New(var/loc)
..()
ptank = new /obj/item/weapon/tank/plasma/full(src)
update_icon()
update_icon()
/obj/item/weapon/flamethrower/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
if(ptank && damage && attack_type == PROJECTILE_ATTACK && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits the fueltank on [owner]'s [src], rupturing it! What a shot!</span>")
var/target_turf = get_turf(owner)
ignite_turf(target_turf, 100)
qdel(ptank)
return 1 //It hit the flamethrower, not them
@@ -102,6 +102,11 @@
spawn(det_time)
prime()
/obj/item/weapon/grenade/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
if(damage && attack_type == PROJECTILE_ATTACK && prob(15))
owner.visible_message("<span class='danger'>[attack_text] hits [owner]'s [src], setting it off! What a shot!</span>")
prime()
return 1 //It hit the grenade, not them
/obj/item/weapon/grenade/chem_grenade/attackby(obj/item/I, mob/user, params)
if(istype(I,/obj/item/weapon/hand_labeler))
@@ -76,9 +76,7 @@
w_class = 5
force = 5
slot_flags = SLOT_BACK
/obj/item/weapon/nullrod/staff/IsShield()
return 1
block_chance = 50
/obj/item/weapon/nullrod/staff/blue
name = "blue holy staff"
@@ -92,16 +90,16 @@
desc = "A weapon fit for a crusade!"
w_class = 4
slot_flags = SLOT_BACK|SLOT_BELT
block_chance = 30
sharp = 1
edge = 1
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
/obj/item/weapon/nullrod/claymore/IsShield()
if(prob(30))
return 1
else
return 0
/obj/item/weapon/nullrod/claymore/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
if(attack_type == PROJECTILE_ATTACK)
final_block_chance = 0 //Don't bring a sword to a gunfight
return ..()
/obj/item/weapon/nullrod/claymore/darkblade
icon_state = "cultblade"
@@ -333,6 +331,7 @@
desc = "A long, tall staff made of polished wood. Traditionally used in ancient old-Earth martial arts, now used to harass the clown."
w_class = 4
force = 15
block_chance = 40
slot_flags = SLOT_BACK
sharp = 0
edge = 0
@@ -342,12 +341,6 @@
icon_state = "bostaff0"
item_state = "bostaff0"
/obj/item/weapon/nullrod/claymore/bostaff/IsShield()
if(prob(40))
return 1
else
return 0
/obj/item/weapon/nullrod/tribal_knife
icon_state = "crysknife"
item_state = "crysknife"
@@ -62,7 +62,7 @@
w_class = 3
w_class_on = 5
hitsound = "swing_hit"
flags = CONDUCT | NOSHIELD
flags = CONDUCT
armour_penetration = 100
origin_tech = "combat=3"
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
@@ -83,9 +83,9 @@
throw_speed = 3
throw_range = 5
hitsound = "swing_hit"
flags = NOSHIELD
armour_penetration = 35
origin_tech = "magnets=3;syndicate=4"
block_chance = 50
sharp = 1
edge = 1
var/hacked = 0
@@ -95,9 +95,9 @@
if(item_color == null)
item_color = pick("red", "blue", "green", "purple")
/obj/item/weapon/melee/energy/sword/IsShield()
/obj/item/weapon/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
if(active)
return 1
return ..()
return 0
/obj/item/weapon/melee/energy/sword/cyborg
@@ -133,7 +133,7 @@
..()
item_color = null
/obj/item/weapon/melee/energy/sword/cyborg/saw/IsShield()
/obj/item/weapon/melee/energy/sword/cyborg/saw/hit_reaction()
return 0
/obj/item/weapon/melee/energy/sword/saber
@@ -206,7 +206,6 @@
throw_speed = 3
throw_range = 1
w_class = 4//So you can't hide it in your pocket or some such.
flags = NOSHIELD
armour_penetration = 50
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
var/datum/effect/system/spark_spread/spark_system
+12 -12
View File
@@ -1,5 +1,6 @@
/obj/item/weapon/shield
name = "shield"
block_chance = 50
/obj/item/weapon/shield/riot
name = "riot shield"
@@ -17,8 +18,10 @@
attack_verb = list("shoved", "bashed")
var/cooldown = 0 //shield bash cooldown. based on world.time
/obj/item/weapon/shield/riot/IsShield()
return 1
/obj/item/weapon/shield/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance, damage, attack_type)
if(attack_type == THROWN_PROJECTILE_ATTACK)
final_block_chance += 30
return ..()
/obj/item/weapon/shield/riot/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/melee/baton))
@@ -41,12 +44,7 @@
icon_state = "buckler"
item_state = "buckler"
materials = list()
/obj/item/weapon/shield/riot/buckler/IsShield()
if(prob(60))
return 1
else
return 0
block_chance = 30
/obj/item/weapon/shield/energy
name = "energy combat shield"
@@ -62,8 +60,8 @@
attack_verb = list("shoved", "bashed")
var/active = 0
/obj/item/weapon/shield/energy/IsShield()
return (active)
/obj/item/weapon/shield/energy/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
return 0
/obj/item/weapon/shield/energy/IsReflect()
return (active)
@@ -109,8 +107,10 @@
w_class = 3
var/active = 0
/obj/item/weapon/shield/riot/tele/IsShield()
return (active)
/obj/item/weapon/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
if(active)
return ..()
return 0
/obj/item/weapon/shield/riot/tele/attack_self(mob/living/user)
active = !active
+1 -3
View File
@@ -8,7 +8,6 @@
throw_speed = 1
throw_range = 5
w_class = 2.0
flags = NOSHIELD
armour_penetration = 100
attack_verb = list("bludgeoned", "whacked", "disciplined")
@@ -73,5 +72,4 @@
throwforce = 5.0
throw_speed = 1
throw_range = 5
w_class = 2.0
flags = NOSHIELD
w_class = 2.0
+1 -1
View File
@@ -134,7 +134,7 @@
/obj/item/weapon/melee/baton/proc/baton_stun(mob/living/L, mob/user)
if(ishuman(L))
var/mob/living/carbon/human/H = L
if(H.check_shields(0, "[user]'s [name]")) //No message; check_shields() handles that
if(H.check_shields(0, "[user]'s [name]", src, MELEE_ATTACK)) //No message; check_shields() handles that
playsound(L, 'sound/weapons/Genhit.ogg', 50, 1)
return
user.lastattacked = L
@@ -53,7 +53,7 @@
if(cooldown <= 0)
if(ishuman(target))
var/mob/living/carbon/human/H = target
if(H.check_shields(0, "[user]'s [name]"))
if(H.check_shields(0, "[user]'s [name]", src, MELEE_ATTACK))
return 0
playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1)
target.Weaken(3)
+4 -15
View File
@@ -120,14 +120,6 @@
/obj/item/weapon/twohanded/offhand/wield()
qdel(src)
/obj/item/weapon/twohanded/offhand/IsShield()//if the actual twohanded weapon is a shield, we count as a shield too!
var/mob/user = loc
if(!istype(user)) return 0
var/obj/item/I = user.get_active_hand()
if(I == src) I = user.get_inactive_hand()
if(!I) return 0
return I.IsShield()
///////////Two hand required objects///////////////
//This is for objects that require two hands to even pick up
/obj/item/weapon/twohanded/required/
@@ -205,10 +197,10 @@
force_wielded = 34
wieldsound = 'sound/weapons/saberon.ogg'
unwieldsound = 'sound/weapons/saberoff.ogg'
flags = NOSHIELD
armour_penetration = 35
origin_tech = "magnets=3;syndicate=4"
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
block_chance = 75
sharp = 1
edge = 1
no_embed = 1 // Like with the single-handed esword, this shouldn't be embedding in people.
@@ -238,11 +230,10 @@
user.dir = i
sleep(1)
/obj/item/weapon/twohanded/dualsaber/IsShield()
/obj/item/weapon/twohanded/dualsaber/hit_reaction(mob/living/carbon/human/owner, attack_text, final_block_chance)
if(wielded)
return 1
else
return 0
return ..()
return 0
/obj/item/weapon/twohanded/dualsaber/green/New()
blade_color = "green"
@@ -296,7 +287,6 @@
throw_speed = 3
armour_penetration = 10
no_spin_thrown = 1 // Thrown spears that spin look dumb. -Fox
flags = NOSHIELD
attack_verb = list("attacked", "poked", "jabbed", "torn", "gored")
/obj/item/weapon/twohanded/spear/update_icon()
@@ -371,7 +361,6 @@
force_wielded = 40 //you'll gouge their eye out! Or a limb...maybe even their entire body!
wieldsound = 'sound/weapons/chainsawstart.ogg'
hitsound = null
flags = NOSHIELD
armour_penetration = 35
origin_tech = "materials=6;syndicate=4"
attack_verb = list("sawed", "cut", "hacked", "carved", "cleaved", "butchered", "felled", "timbered")
+5 -9
View File
@@ -50,13 +50,11 @@
edge = 1
w_class = 3
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
block_chance = 50
IsShield()
return 1
suicide_act(mob/user)
to_chat(viewers(user), "<span class='suicide'>[user] is falling on the [src.name]! It looks like \he's trying to commit suicide.</span>")
return(BRUTELOSS)
/obj/item/weapon/claymore/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is falling on the [src.name]! It looks like \he's trying to commit suicide.</span>")
return(BRUTELOSS)
/obj/item/weapon/claymore/ceremonial
name = "ceremonial claymore"
@@ -77,6 +75,7 @@
w_class = 3
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut")
block_chance = 50
/obj/item/weapon/katana/cursed
slot_flags = null
@@ -85,9 +84,6 @@
user.visible_message("<span class='suicide'>[user] is slitting \his stomach open with the [src.name]! It looks like \he's trying to commit seppuku.</span>")
return(BRUTELOSS)
/obj/item/weapon/katana/IsShield()
return 1
/obj/item/weapon/harpoon
name = "harpoon"
sharp = 1
@@ -46,7 +46,7 @@
new /obj/item/device/radio/headset/heads/rd(src)
new /obj/item/weapon/tank/air(src)
new /obj/item/clothing/mask/gas(src)
new /obj/item/clothing/suit/armor/reactive(src)
new /obj/item/clothing/suit/armor/reactive/teleport(src)
new /obj/item/device/flash(src)
new /obj/item/device/laser_pointer(src)
new /obj/item/weapon/door_remote/research_director(src)