Adds the vortex feedback inversion arm. (#19821)

* start of mess

* reflect/parries works

* more pog-ress

* temp icons, .33 to 0.4

* more work, sound, rnd, fixes me breaking shields

* removes this since open pr fixes

* better codee

* attack log

* Final changes / sprites by ramon

* fixes issue

* shoot ramon for the white pixel :^)

* But what if it was a purple glass shard

* Fixes the throw parry

* sorry for so many commits, lower callback

* Apply suggestions from code review

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>

* Early return, no need to typecast

Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Qwertytoforty
2022-12-27 10:45:59 -05:00
committed by GitHub
parent 4cd66496a5
commit f86374a504
13 changed files with 169 additions and 15 deletions
@@ -32,8 +32,12 @@ emp_act
return -1
//Shields
if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration_flat, P.armour_penetration_percentage))
var/shield_check_result = check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration_flat, P.armour_penetration_percentage)
if(shield_check_result == 1)
return 2
else if(shield_check_result == -1)
P.reflect_back(src)
return -1
if(mind?.martial_art?.deflection_chance) //Some martial arts users can deflect projectiles!
if(!IS_HORIZONTAL(src) && !HAS_TRAIT(src, TRAIT_HULK) && mind.martial_art.try_deflect(src)) //But only if they're not lying down, and hulks can't do it
@@ -219,9 +223,11 @@ emp_act
/mob/living/carbon/human/proc/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration_flat = 0, armour_penetration_percentage = 0)
var/obj/item/shield = get_best_shield()
if(shield?.hit_reaction(src, AM, attack_text, 0, damage, attack_type))
var/shield_result = shield?.hit_reaction(src, AM, attack_text, 0, damage, attack_type)
if(shield_result >= 1)
return TRUE
if(shield_result == -1)
return -1
if(wear_suit && wear_suit.hit_reaction(src, AM, attack_text, 0, damage, attack_type))
return TRUE
@@ -280,3 +280,14 @@
materials = list(MAT_GOLD = 5000, MAT_URANIUM = 4000, MAT_METAL = 5000, MAT_TITANIUM = 2000, MAT_BLUESPACE = 2000)
build_path = /obj/item/weaponcrafting/gunkit/u_ionsilencer
category = list("Weapons")
/datum/design/v1_arm
name = "Vortex arm implant shell"
desc = "A shell to make an arm able to parry, reflect, and boost the power of incoming projectiles."
id = "v1_arm"
req_tech = list("combat" = 7, "magnets" = 6, "engineering" = 6, "biotech" = 7)
build_type = PROTOLATHE
materials = list(MAT_GOLD = 5000, MAT_URANIUM = 4000, MAT_METAL = 10000, MAT_TITANIUM = 2000, MAT_BLUESPACE = 2000)
reagents_list = list("blood" = 50)
build_path = /obj/item/v1_arm_shell
category = list("Weapons")
@@ -411,3 +411,127 @@
contents = newlist(/obj/item/mop/advanced)
action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/janitor.dmi')
action_icon_state = list(/datum/action/item_action/organ_action/toggle = "advmop")
/obj/item/organ/internal/cyberimp/arm/v1_arm
name = "vortex feedback arm implant"
desc = "An implant, that when deployed surrounds the users arm in armor and circuitry, allowing them to redirect nearby projectiles with feedback from the vortex anomaly core."
origin_tech = "combat=6;magnets=6;biotech=6;engineering=6"
icon = 'icons/obj/items.dmi'
icon_state = "v1_arm"
parent_organ = "l_arm" //Left arm by default
slot = "l_arm_device"
contents = newlist(/obj/item/shield/v1_arm)
action_icon = list(/datum/action/item_action/organ_action/toggle = 'icons/obj/items.dmi')
action_icon_state = list(/datum/action/item_action/organ_action/toggle = "v1_arm")
var/disabled = FALSE
/obj/item/organ/internal/cyberimp/arm/v1_arm/emp_act(severity)
if(emp_proof && !disabled)
return
disabled = TRUE
addtimer(VARSET_CALLBACK(src, disabled, FALSE), 10 SECONDS)
/obj/item/organ/internal/cyberimp/arm/v1_arm/Extend(obj/item/item)
if(disabled)
to_chat(owner, "<span class='warning'>Your arm fails to extend!</span>")
return FALSE
..()
/obj/item/organ/internal/cyberimp/arm/v1_arm/Retract()
if(disabled)
to_chat(owner, "<span class='warning'>Your arm fails to retract!</span>")
return FALSE
..()
/obj/item/shield/v1_arm
name = "vortex feedback arm" //format is they are holding x
desc = "A modification to a users arm, allowing them to use a vortex core energy feedback, to parry, reflect, and even empower projectile attack. Rumors that it runs on the users blood are unconfirmed"
icon_state = "v1_arm"
item_state = "v1_arm"
sprite_sheets_inhand = list("Drask" = 'icons/mob/clothing/species/drask/held.dmi', "Vox" = 'icons/mob/clothing/species/vox/held.dmi')
force = 20 //bonk, not sharp
attack_verb = list("slamed", "punched", "parried", "judged", "styled on", "disrespected", "interupted", "gored")
hitsound = 'sound/effects/bang.ogg'
light_power = 3
light_range = 0
light_color = "#9933ff"
hit_reaction_chance = -1
/// The damage the reflected projectile will be increased by
var/reflect_damage_boost = 10
/// The cap of the reflected damage. Damage will not be increased above 50, however it will not be reduced to 50 either.
var/reflect_damage_cap = 50
var/disabled = FALSE
var/force_when_disabled = 5 //still basically a metal pipe, just hard to move
/obj/item/shield/v1_arm/emp_act(severity)
if(disabled)
return
to_chat(loc, "<span class='warning'>Your arm seises up!</span>")
disabled = TRUE
force = force_when_disabled
addtimer(CALLBACK(src, PROC_REF(reboot)), 10 SECONDS)
/obj/item/shield/v1_arm/proc/reboot()
disabled = FALSE
force = initial(force)
/obj/item/shield/v1_arm/add_parry_component()
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.35, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (1 / 3) SECONDS, _no_parry_sound = TRUE) // 0.3333 seconds of cooldown for 75% uptime, countered by ions and plasma pistols
/obj/item/shield/v1_arm/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(disabled)
return FALSE
// Hit by a melee weapon or blocked a projectile
. = ..()
if(!.) // they did not block the attack
return
if(. == 1) // a normal block
owner.visible_message("<span class='danger'>[owner] blocks [attack_text] with [src]!</span>")
playsound(src, 'sound/weapons/effects/ric3.ogg', 100, TRUE)
return TRUE
set_light(3)
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light), 0), 0.25 SECONDS)
if(istype(hitby, /obj/item/projectile))
var/obj/item/projectile/P = hitby
if(P.shield_buster || istype(P, /obj/item/projectile/ion)) //EMP's and unpariable attacks, after all.
return FALSE
if(P.reflectability == REFLECTABILITY_NEVER) //only 1 magic spell does this, but hey, needed
owner.visible_message("<span class='danger'>[owner] blocks [attack_text] with [src]!</span>")
playsound(src, 'sound/weapons/effects/ric3.ogg', 100, TRUE)
return TRUE
P.damage = clamp((P.damage + 10), P.damage, reflect_damage_cap)
var/sound = pick('sound/effects/explosion1.ogg', 'sound/effects/explosion2.ogg', 'sound/effects/meteorimpact.ogg')
P.hitsound = sound
P.hitsound_wall = sound
P.add_overlay("parry")
playsound(src, 'sound/weapons/v1_parry.ogg', 100, TRUE)
owner.visible_message("<span class='danger'>[owner] parries [attack_text] with [src]!</span>")
add_attack_logs(P.firer, src, "hit by [P.type] but got parried by [src]")
return -1
owner.visible_message("<span class='danger'>[owner] parries [attack_text] with [src]!</span>")
playsound(src, 'sound/weapons/v1_parry.ogg', 100, TRUE)
if(isitem(hitby)) //Thrown items
var/obj/item/TT = hitby
addtimer(CALLBACK(TT, TYPE_PROC_REF(/atom/movable, throw_at), locateUID(TT.thrownby), 15, 15, owner), 0.1 SECONDS) //yeet that shit right back
return TRUE
melee_attack_chain(owner, hitby)
return TRUE
/obj/item/v1_arm_shell
name = "vortex feedback arm implant frame"
desc = "An implant awaiting installation of a vortex anomaly core"
icon_state = "v1_arm"
/obj/item/v1_arm_shell/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/assembly/signaler/anomaly/vortex))
to_chat(user, "<span class='notice'>You insert [I] into the back of the hand, and the implant begins to boot up.</span>")
new /obj/item/organ/internal/cyberimp/arm/v1_arm(get_turf(src))
qdel(src)
qdel(I)
return ..()