Files
Paradise/code/game/objects/items/weapons/shields.dm
Spaghetti-bit cbeedfca9f Parrying Refactor, Adding Parrying to Select Two-handed Weapons: Parry This You Filthy Casual! (#26043)
* Refactors parrying and how parrying is handled. Also gives most of the melee wizard weapons parrying as well as most two handed weapons.

* Forgor the blood spear :)

* Renames `special_parry_condition` to `requires_two_hands`

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Update code/datums/components/parry.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Apply suggestions from code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* applies suggestion from @lewcc

* Removes the two handed requirement from cult spear as per @Qwerty's request

* Apply suggestions from code review (1/2) from hal

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>

* Apply suggestions from code review (2/2)

* ...accidentally removed an icon in `energy_melee_weapons.dm` when I deconflicted stuff. 💀 ready for review.

* Again, variable added back during deconflict. issues resolved.

* Update code/game/objects/items/weapons/shields.dm

Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

---------

Signed-off-by: Spaghetti-bit <yumyumkillkill@gmail.com>
Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
2024-07-30 12:33:02 +00:00

176 lines
6.2 KiB
Plaintext

/obj/item/shield
name = "shield"
icon = 'icons/obj/weapons/shield.dmi'
lefthand_file = 'icons/mob/inhands/weapons_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons_righthand.dmi'
armor = list(MELEE = 50, BULLET = 50, LASER = 50, ENERGY = 0, BOMB = 30, RAD = 0, FIRE = 80, ACID = 70)
/obj/item/shield/proc/add_parry_component()
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = ALL_ATTACK_TYPES)
/obj/item/shield/Initialize(mapload)
. = ..()
add_parry_component()
/obj/item/shield/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(attack_type == LEAP_ATTACK)
final_block_chance = 100
return ..()
/obj/item/shield/riot
name = "riot shield"
desc = "A shield adept at blocking blunt objects from connecting with the torso of the shield wielder."
icon_state = "riot"
slot_flags = SLOT_FLAG_BACK
force = 10
throwforce = 5
throw_speed = 2
throw_range = 3
w_class = WEIGHT_CLASS_BULKY
materials = list(MAT_GLASS=7500, MAT_METAL=1000)
origin_tech = "materials=3;combat=4"
attack_verb = list("shoved", "bashed")
var/cooldown = 0 //shield bash cooldown. based on world.time
var/list/allowed_bashers = list(/obj/item/melee/baton, /obj/item/kitchen/knife/combat)
/obj/item/shield/riot/attackby(obj/item/W, mob/user, params)
if(is_type_in_list(W, allowed_bashers))
if(cooldown < world.time - 2.5 SECONDS)
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/shield/riot/roman
name = "roman shield"
desc = "Bears an inscription on the inside: <i>\"Romanes venio domus\"</i>."
icon_state = "roman_shield"
item_state = "roman_shield"
materials = list(MAT_METAL=8500)
/obj/item/shield/riot/roman/fake
desc = "Bears an inscription on the inside: <i>\"Romanes venio domus\"</i>. It appears to be a bit flimsy."
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, rad = 0, fire = 0, acid = 0)
/obj/item/shield/riot/roman/fake/add_parry_component()
return
/obj/item/shield/riot/buckler
name = "wooden buckler"
desc = "A medieval wooden buckler."
icon_state = "buckler"
item_state = "buckler"
materials = list()
origin_tech = "materials=1;combat=3;biotech=2"
resistance_flags = FLAMMABLE
/obj/item/shield/riot/buckler/add_parry_component()
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (10 / 3) SECONDS) // 2.3333 seconds of cooldown for 30% uptime
/obj/item/shield/energy
name = "energy combat shield"
desc = "A shield that reflects almost all energy projectiles, but is useless against physical attacks. It can be retracted, expanded, and stored anywhere."
icon_state = "eshield0" // eshield1 for expanded
force = 3
throwforce = 3
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_TINY
origin_tech = "materials=4;magnets=5;syndicate=6"
attack_verb = list("shoved", "bashed")
var/active = FALSE
/obj/item/shield/energy/add_parry_component()
return
/obj/item/shield/energy/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(isprojectile(hitby))
var/obj/item/projectile/P = hitby
if(P.shield_buster && active)
toggle(owner, TRUE)
to_chat(owner, "<span class='warning'>[hitby] overloaded your [src]!</span>")
return 0
/obj/item/shield/energy/IsReflect()
return (active)
/obj/item/shield/energy/attack_self(mob/living/carbon/human/user)
toggle(user, FALSE)
/obj/item/shield/energy/proc/toggle(mob/living/carbon/human/user, forced)
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50) && !forced)
to_chat(user, "<span class='warning'>You beat yourself in the head with [src].</span>")
user.take_organ_damage(5)
active = !active
icon_state = "eshield[active]"
if(active)
force = 10
throwforce = 8
throw_speed = 2
w_class = WEIGHT_CLASS_BULKY
playsound(user, 'sound/weapons/saberon.ogg', 35, 1)
to_chat(user, "<span class='notice'>[src] is now active.</span>")
else
force = 3
throwforce = 3
throw_speed = 3
w_class = WEIGHT_CLASS_TINY
playsound(user, 'sound/weapons/saberoff.ogg', 35, 1)
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.update_inv_l_hand()
H.update_inv_r_hand()
if(!forced)
add_fingerprint(user)
return
/obj/item/shield/riot/tele
name = "telescopic shield"
desc = "An advanced riot shield made of lightweight materials that collapses for easy storage."
icon_state = "teleriot0"
origin_tech = "materials=3;combat=4;engineering=4"
slot_flags = null
force = 3
throwforce = 3
throw_speed = 3
throw_range = 4
w_class = WEIGHT_CLASS_NORMAL
/obj/item/shield/riot/tele/add_parry_component()
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (5 / 3) SECONDS, _requires_activation = TRUE)
/obj/item/shield/riot/tele/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(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE))
return ..()
return FALSE // by not calling the parent the hit_reaction signal is never sent
/obj/item/shield/riot/tele/attack_self(mob/living/user)
if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE))
REMOVE_TRAIT(src,TRAIT_ITEM_ACTIVE, TRAIT_GENERIC)
force = 3
throwforce = 3
throw_speed = 3
w_class = WEIGHT_CLASS_NORMAL
slot_flags = null
to_chat(user, "<span class='notice'>[src] can now be concealed.</span>")
else
ADD_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC)
force = 8
throwforce = 5
throw_speed = 2
w_class = WEIGHT_CLASS_BULKY
slot_flags = SLOT_FLAG_BACK
to_chat(user, "<span class='notice'>You extend \the [src].</span>")
icon_state = "teleriot[HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)]"
playsound(loc, 'sound/weapons/batonextend.ogg', 50, TRUE)
if(ishuman(user))
var/mob/living/carbon/human/H = user
H.update_inv_l_hand()
H.update_inv_r_hand()
add_fingerprint(user)
return