From 88476273fd0438e33e18e64d010704f46d48043b Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Tue, 26 May 2020 23:46:15 -0700 Subject: [PATCH] almost ready --- code/game/objects/items/shields.dm | 54 +++++++++---------- code/modules/keybindings/keybind/combat.dm | 2 +- .../modules/mob/living/living_active_block.dm | 20 ++++--- code/modules/mob/living/living_movement.dm | 14 +++-- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/code/game/objects/items/shields.dm b/code/game/objects/items/shields.dm index 65c027217c..377b58c09d 100644 --- a/code/game/objects/items/shields.dm +++ b/code/game/objects/items/shields.dm @@ -1,7 +1,6 @@ /obj/item/shield name = "shield" icon = 'icons/obj/shields.dmi' - block_chance = 50 item_flags = ITEM_CAN_BLOCK block_parry_data = /datum/block_parry_data/shield armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 70) @@ -160,6 +159,22 @@ icon_state = "shield_bash" duration = 3 +/obj/item/shield/run_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) + if(ismovable(object)) + var/atom/movable/AM = object + if(CHECK_BITFIELD(shield_flags, SHIELD_TRANSPARENT) && (AM.pass_flags & PASSGLASS)) + return BLOCK_NONE + if(attack_type & ATTACK_TYPE_THROWN) + final_block_chance += 30 + if(attack_type & ATTACK_TYPE_TACKLE) + final_block_chance = 100 + . = ..() + if(. & BLOCK_SUCCESS) + on_shield_block(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) + +/obj/item/shield/on_active_block(mob/living/owner, atom/object, damage, damage_blocked, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return, override_direction) + on_shield_block(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance) + /obj/item/shield/riot name = "riot shield" desc = "A shield adept at blocking blunt objects from connecting with the torso of the shield wielder." @@ -178,20 +193,7 @@ var/repair_material = /obj/item/stack/sheet/mineral/titanium var/can_shatter = TRUE shield_flags = SHIELD_FLAGS_DEFAULT | SHIELD_TRANSPARENT - max_integrity = 75 - -/obj/item/shield/run_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) - if(ismovable(object)) - var/atom/movable/AM = object - if(CHECK_BITFIELD(shield_flags, SHIELD_TRANSPARENT) && (AM.pass_flags & PASSGLASS)) - return BLOCK_NONE - if(attack_type & ATTACK_TYPE_THROWN) - final_block_chance += 30 - if(attack_type & ATTACK_TYPE_TACKLE) - final_block_chance = 100 - . = ..() - if(. & BLOCK_SUCCESS) - on_shield_block(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) + max_integrity = 300 /obj/item/shield/riot/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/melee/baton)) @@ -244,13 +246,13 @@ lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi' righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' shield_flags = SHIELD_FLAGS_DEFAULT - max_integrity = 55 //Weak + max_integrity = 200 obj/item/shield/riot/bullet_proof name = "bullet resistant shield" desc = "A far more frail shield made of resistant plastics and kevlar meant to block ballistics." armor = list("melee" = 30, "bullet" = 80, "laser" = 0, "energy" = 0, "bomb" = -40, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 50) - max_integrity = 55 //Weaker + max_integrity = 200 /obj/item/shield/riot/roman name = "\improper Roman shield" @@ -261,13 +263,13 @@ obj/item/shield/riot/bullet_proof righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi' repair_material = /obj/item/stack/sheet/mineral/wood shield_flags = SHIELD_FLAGS_DEFAULT - max_integrity = 65 + max_integrity = 250 /obj/item/shield/riot/roman/fake desc = "Bears an inscription on the inside: \"Romanes venio domus\". It appears to be a bit flimsy." block_chance = 0 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 0, "acid" = 0) - max_integrity = 30 + max_integrity = 40 /obj/item/shield/riot/roman/shatter(mob/living/carbon/human/owner) playsound(owner, 'sound/effects/grillehit.ogg', 100) @@ -285,7 +287,7 @@ obj/item/shield/riot/bullet_proof repair_material = /obj/item/stack/sheet/mineral/wood block_chance = 30 shield_flags = SHIELD_FLAGS_DEFAULT - max_integrity = 55 + max_integrity = 150 /obj/item/shield/riot/buckler/shatter(mob/living/carbon/human/owner) playsound(owner, 'sound/effects/bang.ogg', 50) @@ -344,8 +346,7 @@ obj/item/shield/riot/bullet_proof icon_state = "makeshift_shield" custom_materials = list(/datum/material/iron = 18000) slot_flags = null - block_chance = 35 - max_integrity = 100 //Made of metal welded together its strong but not unkillable + max_integrity = 300 //Made of metal welded together its strong but not unkillable force = 10 throwforce = 7 @@ -355,7 +356,6 @@ obj/item/shield/riot/bullet_proof armor = list("melee" = 95, "bullet" = 95, "laser" = 75, "energy" = 60, "bomb" = 90, "bio" = 90, "rad" = 0, "fire" = 90, "acid" = 10) //Armor for the item, dosnt transfer to user item_state = "metal" icon_state = "metal" - block_chance = 75 //1/4 shots will hit* force = 16 slowdown = 2 throwforce = 15 //Massive pice of metal @@ -366,19 +366,17 @@ obj/item/shield/riot/bullet_proof /obj/item/shield/riot/tower/swat name = "swat shield" desc = "A massive, heavy shield that can block a lot of attacks, can take a lot of abuse before breaking." - max_integrity = 175 - block_chance = 50 + max_integrity = 250 /obj/item/shield/riot/implant name = "telescoping shield implant" desc = "A compact, arm-mounted telescopic shield. While nigh-indestructible when powered by a host user, it will eventually overload from damage. Recharges while inside its implant." item_state = "metal" icon_state = "metal" - block_chance = 50 slowdown = 1 shield_flags = SHIELD_FLAGS_DEFAULT - max_integrity = 60 - obj_integrity = 60 + max_integrity = 100 + obj_integrity = 100 can_shatter = FALSE item_flags = SLOWS_WHILE_IN_HAND var/recharge_timerid diff --git a/code/modules/keybindings/keybind/combat.dm b/code/modules/keybindings/keybind/combat.dm index 55ee56b324..1c68297c27 100644 --- a/code/modules/keybindings/keybind/combat.dm +++ b/code/modules/keybindings/keybind/combat.dm @@ -27,7 +27,7 @@ /datum/keybinding/living/active_block/up(client/user) var/mob/living/L = user.mob - L.keybind_start_active_blocking() + L.keybind_stop_active_blocking() /datum/keybinding/living/active_parry hotkey_keys = list("Insert", "G") diff --git a/code/modules/mob/living/living_active_block.dm b/code/modules/mob/living/living_active_block.dm index 1a157ad72d..cde72e0fa3 100644 --- a/code/modules/mob/living/living_active_block.dm +++ b/code/modules/mob/living/living_active_block.dm @@ -125,8 +125,10 @@ /obj/item/proc/can_active_block() return item_flags & ITEM_CAN_BLOCK -/// The amount of damage that is blocked. -/obj/item/proc/active_block_damage_mitigation(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) +/** + * Calculates FINAL ATTACK DAMAGE after mitigation + */ +/obj/item/proc/active_block_calculate_final_damage(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) var/datum/block_parry_data/data = get_block_parry_data() var/absorption = data.attack_type_list_scan(data.block_damage_absorption_override, attack_type) var/efficiency = data.attack_type_list_scan(data.block_damage_multiplier_override, attack_type) @@ -183,6 +185,9 @@ else owner.adjustStaminaLossBuffered(stamina_amount) +/obj/item/proc/on_active_block(mob/living/owner, atom/object, damage, damage_blocked, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return, override_direction) + return + /obj/item/proc/active_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return, override_direction) if(!can_active_block()) return BLOCK_NONE @@ -199,11 +204,11 @@ else if(!can_block_direction(owner.dir, incoming_direction)) return BLOCK_NONE block_return[BLOCK_RETURN_ACTIVE_BLOCK] = TRUE - var/damage_mitigated = active_block_damage_mitigation(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) - var/final_damage = max(0, damage - damage_mitigated) - var/stamina_cost = active_block_stamina_cost(owner, object, final_damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) + var/final_damage = active_block_calculate_final_damage(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) + var/damage_blocked = damage - final_damage + var/stamina_cost = active_block_stamina_cost(owner, object, damage_blocked, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) active_block_do_stamina_damage(owner, object, stamina_cost, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) - block_return[BLOCK_RETURN_ACTIVE_BLOCK_DAMAGE_MITIGATED] = damage_mitigated + block_return[BLOCK_RETURN_ACTIVE_BLOCK_DAMAGE_MITIGATED] = damage - final_damage block_return[BLOCK_RETURN_SET_DAMAGE_TO] = final_damage . = BLOCK_SHOULD_CHANGE_DAMAGE if(final_damage <= 0) @@ -213,6 +218,7 @@ owner.visible_message("[owner] dampens \the [attack_text] with [src]!") if(length(data.block_sounds)) playsound(loc, pickweight(data.block_sounds), 75, TRUE) + on_active_block(owner, object, damage, damage_blocked, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return, override_direction) /obj/item/proc/check_active_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) if(!can_active_block()) @@ -221,7 +227,7 @@ if(!can_block_direction(owner.dir, incoming_direction)) return block_return[BLOCK_RETURN_ACTIVE_BLOCK] = TRUE - block_return[BLOCK_RETURN_ACTIVE_BLOCK_DAMAGE_MITIGATED] = active_block_damage_mitigation(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) + block_return[BLOCK_RETURN_ACTIVE_BLOCK_DAMAGE_MITIGATED] = damage - active_block_calculate_final_damage(owner, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone, final_block_chance, block_return) /** * Gets the block direction bitflags of what we can block. diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 4b90191dcc..d5f04ade7c 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -3,10 +3,16 @@ update_turf_movespeed(loc) //Hide typing indicator if we move. clear_typing_indicator() - if(is_shifted) - is_shifted = FALSE - pixel_x = get_standard_pixel_x_offset(lying) - pixel_y = get_standard_pixel_y_offset(lying) + update_pixel_shifting() + +/mob/living/proc/update_pixel_shifting() + if(active_blocking) + animate(src, pixel_x = get_standard_pixel_x_offset(), pixel_y = get_standard_pixel_y_offset(), time = 1.5, easing = SINE_EASING | EASE_OUT , flags = ANIMATION_END_NOW) + else + if(is_shifted) + is_shifted = FALSE + pixel_x = get_standard_pixel_x_offset(lying) + pixel_y = get_standard_pixel_y_offset(lying) /mob/living/CanPass(atom/movable/mover, turf/target) if((mover.pass_flags & PASSMOB))