Skip to content

Commit

Permalink
Revert "adds directional blocking (#1103)"
Browse files Browse the repository at this point in the history
This reverts commit b689005.
  • Loading branch information
Kapu1178 authored Oct 28, 2024
1 parent b689005 commit 59c91cb
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 84 deletions.
27 changes: 0 additions & 27 deletions code/__HELPERS/combat_helpers.dm

This file was deleted.

2 changes: 2 additions & 0 deletions code/__HELPERS/_type2type.dm → code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
return SOUTHEAST
if("SOUTHWEST")
return SOUTHWEST
else
return

//Converts an angle (degrees) into a ss13 direction
GLOBAL_LIST_INIT(modulo_angle_to_dir, list(NORTH,NORTHEAST,EAST,SOUTHEAST,SOUTH,SOUTHWEST,WEST,NORTHWEST))
Expand Down
8 changes: 4 additions & 4 deletions code/datums/martial/sleeping_carp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
else
return ..()

/obj/item/staff/bostaff/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
if(!wielded)
return FALSE
return ..()
/obj/item/staff/bostaff/get_block_chance(atom/movable/hitby, damage, attack_type, armor_penetration)
if(wielded)
return ..()
return FALSE
14 changes: 1 addition & 13 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,6 @@ DEFINE_INTERACTABLE(/obj/item)

/// The baseline chance to block **ANY** attack, projectiles included
var/block_chance = 0
/// The angle infront of the defender that is a valid block range.
var/block_angle = 45 // Infront and infront + sides, but not direct sides

/// The type of effect to create on a successful block
var/obj/effect/temp_visual/block_effect = /obj/effect/temp_visual/block

Expand Down Expand Up @@ -706,8 +703,7 @@ DEFINE_INTERACTABLE(/obj/item)
var/sig_return = SEND_SIGNAL(src, COMSIG_ITEM_CHECK_BLOCK)
var/block_result = sig_return & COMPONENT_CHECK_BLOCK_BLOCKED

if(!block_result && can_block_attack(wielder, hitby, attack_type))
block_result = prob(get_block_chance(wielder, hitby, damage, attack_type, armor_penetration))
block_result ||= prob(get_block_chance(wielder, hitby, damage, attack_type, armor_penetration))

var/list/reaction_args = args.Copy()
if(block_result)
Expand All @@ -724,14 +720,6 @@ DEFINE_INTERACTABLE(/obj/item)

return block_result

/// Checks if this item can block an incoming attack.
/obj/item/proc/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
var/angle = get_relative_attack_angle(wielder, hitby)
if(angle <= block_angle)
return TRUE

return FALSE

/// Returns a number to feed into prob() to determine if the attack was blocked.
/obj/item/proc/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
var/block_chance_modifier = round(damage / -3)
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/items/dualsaber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@
else
user.stamina.adjust(-25)

/obj/item/dualsaber/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
if(!wielded)
return FALSE
return ..()
/obj/item/dualsaber/get_block_chance(atom/movable/hitby, damage, attack_type, armor_penetration)
if(wielded)
return ..()
return FALSE

/obj/item/dualsaber/process()
if(!wielded)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/grenades/_grenade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@
/obj/item/grenade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
var/obj/projectile/hit_projectile = hitby
if(!istype(hitby))
return 0
return FALSE

if(damage && attack_type == PROJECTILE_ATTACK && hit_projectile.damage_type != STAMINA && prob(15))
return 100
return TRUE

/obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", damage = 0, attack_type = MELEE_ATTACK, block_success = TRUE)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/holy_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
attack_verb_simple = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
menu_description = "A sharp claymore which provides a low chance of blocking incoming melee attacks. Can be worn on the back or belt."

/obj/item/nullrod/claymore/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/nullrod/claymore/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(attack_type == PROJECTILE_ATTACK)
return FALSE
return ..()
Expand Down
10 changes: 5 additions & 5 deletions code/game/objects/items/melee/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@
block_chance = 50
embedding = list("embed_chance" = 75, "impact_pain_mult" = 10)

/obj/item/melee/energy/sword/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
if(!blade_active)
return FALSE
return ..()
/obj/item/melee/energy/sword/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(blade_active)
return ..()
return FALSE

/obj/item/melee/energy/sword/cyborg
name = "cyborg energy sword"
Expand Down Expand Up @@ -223,7 +223,7 @@
active_force = 30
sword_color_icon = null // Stops icon from breaking when turned on.

/obj/item/melee/energy/sword/cyborg/saw/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/melee/energy/sword/cyborg/saw/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
return FALSE

// The colored energy swords we all know and love.
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/melee/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
. = ..()
AddComponent(/datum/component/butchering, 30, 95, 5) //fast and effective, but as a sword, it might damage the results.

/obj/item/melee/sabre/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/melee/sabre/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(attack_type == PROJECTILE_ATTACK)
return FALSE
return FALSE //Don't bring a sword to a gunfight
return ..()

/obj/item/melee/sabre/on_exit_storage(datum/storage/container)
Expand Down
13 changes: 5 additions & 8 deletions code/game/objects/items/shields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
max_integrity = 75


/obj/item/shield/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/shield/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(transparent && (hitby.pass_flags & PASSGLASS))
return FALSE
return ..()

/obj/item/shield/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
. = ..()
if(attack_type == THROWN_PROJECTILE_ATTACK)
. += 30
Expand Down Expand Up @@ -272,10 +269,10 @@
attack_verb_simple_on = list("smack", "strike", "crack", "beat"))
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))

/obj/item/shield/riot/tele/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
if(!extended)
return FALSE
return ..()
/obj/item/shield/riot/tele/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(extended)
return ..()
return FALSE

/*
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@
attack_verb_continuous = list("attacks", "strikes", "hits")
attack_verb_simple = list("attack", "strike", "hit")

/obj/item/dualsaber/toy/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/dualsaber/toy/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
return FALSE

/obj/item/dualsaber/toy/IsReflect() //Stops Toy Dualsabers from reflecting energy projectiles
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weaponry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301

/obj/item/highfrequencyblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if((attack_type == PROJECTILE_ATTACK) && wielded)
return 100
return TRUE

. = ..()

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/beds_chairs/chair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0)
/obj/item/chair/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
. = ..()
if(prob(50) && ((attack_type == UNARMED_ATTACK) || (attack_type == LEAP_ATTACK)))
return 100
return TRUE

/obj/item/chair/block_feedback(mob/living/carbon/human/wielder, attack_text, attack_type, do_message = TRUE, do_sound = TRUE)
if(do_message)
Expand Down
15 changes: 8 additions & 7 deletions code/modules/antagonists/cult/cult_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ Striking a noncultist, however, will tear their flesh."}

AddComponent(/datum/component/cult_ritual_item, span_cult(examine_text))

/obj/item/melee/cultblade/dagger/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
if(attack_type == PROJECTILE_ATTACK)
return FALSE
return ..()
/obj/item/melee/cultblade/dagger/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(IS_CULTIST(wielder) && attack_type != PROJECTILE_ATTACK)
return ..()

return FALSE

/obj/item/melee/cultblade/dagger/block_feedback(mob/living/carbon/human/wielder, attack_text, attack_type, do_message = TRUE, do_sound = TRUE)
if(do_message)
Expand Down Expand Up @@ -77,7 +78,7 @@ Striking a noncultist, however, will tear their flesh."}
. = ..()
AddComponent(/datum/component/butchering, 40, 100)

/obj/item/melee/cultblade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/melee/cultblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(IS_CULTIST(wielder))
return ..()

Expand Down Expand Up @@ -277,15 +278,13 @@ Striking a noncultist, however, will tear their flesh."}
holder.apply_status_effect(/datum/status_effect/sword_spin)
sword.spinning = TRUE
sword.block_chance = 100
sword.block_angle = 180
sword.slowdown += 1.5
addtimer(CALLBACK(src, PROC_REF(stop_spinning)), 50)
holder?.update_mob_action_buttons()

/datum/action/innate/cult/spin2win/proc/stop_spinning()
sword.spinning = FALSE
sword.block_chance = 50
sword.block_angle = 45
sword.slowdown -= 1.5
sleep(sword.spin_cooldown)
holder?.update_mob_action_buttons()
Expand Down Expand Up @@ -776,6 +775,8 @@ Striking a noncultist, however, will tear their flesh."}
qdel(src)

/obj/item/melee/cultblade/halberd/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(!IS_CULTIST(wielder))
return FALSE
. = ..()
if(wielded)
. *= 2
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/suits/reactive_armour.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
update_icon()
add_fingerprint(user)

/obj/item/clothing/suit/armor/reactive/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/clothing/suit/armor/reactive/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(!active)
return FALSE

Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/magic/staff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
. = ..()
AddComponent(/datum/component/butchering, 15, 125, 0, hitsound)

/obj/item/gun/magic/staff/spellblade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/gun/magic/staff/spellblade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(attack_type == PROJECTILE_ATTACK)
return FALSE

Expand Down
6 changes: 2 additions & 4 deletions code/modules/religion/sparring/ceremonial_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
force = old_force
throwforce = old_throwforce

/obj/item/ceremonial_blade/can_block_attack(mob/living/carbon/human/wielder, atom/movable/hitby, attack_type)
/obj/item/ceremonial_blade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
if(attack_type != MELEE_ATTACK || !ishuman(hitby.loc))
return FALSE
return ..()
return ..()

/obj/item/ceremonial_blade/get_block_chance(mob/living/carbon/human/wielder, atom/movable/hitby, damage, attack_type, armor_penetration)
. = ..()
if(HAS_TRAIT(hitby.loc, TRAIT_SPARRING))
//becomes 30 block
Expand Down
3 changes: 1 addition & 2 deletions daedalus.dme
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@
#include "code\__HELPERS\_lists.dm"
#include "code\__HELPERS\_logging.dm"
#include "code\__HELPERS\_string_lists.dm"
#include "code\__HELPERS\_type2type.dm"
#include "code\__HELPERS\admin.dm"
#include "code\__HELPERS\ai.dm"
#include "code\__HELPERS\areas.dm"
Expand All @@ -356,7 +355,6 @@
#include "code\__HELPERS\clients.dm"
#include "code\__HELPERS\cmp.dm"
#include "code\__HELPERS\colors.dm"
#include "code\__HELPERS\combat_helpers.dm"
#include "code\__HELPERS\config.dm"
#include "code\__HELPERS\construction.dm"
#include "code\__HELPERS\dates.dm"
Expand Down Expand Up @@ -410,6 +408,7 @@
#include "code\__HELPERS\time.dm"
#include "code\__HELPERS\traits.dm"
#include "code\__HELPERS\turfs.dm"
#include "code\__HELPERS\type2type.dm"
#include "code\__HELPERS\type_processing.dm"
#include "code\__HELPERS\typelists.dm"
#include "code\__HELPERS\varset_callback.dm"
Expand Down

0 comments on commit 59c91cb

Please sign in to comment.