From 2113b634285d1bf438542404f3c451f6be8588fd Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Sat, 14 Mar 2020 21:42:23 -0700
Subject: [PATCH] o boy
---
code/__DEFINES/combat.dm | 2 +
code/__DEFINES/dcs/signals.dm | 1 +
code/_onclick/item_attack.dm | 2 +-
code/game/objects/items.dm | 1 -
code/game/objects/items/melee/misc.dm | 2 +-
code/game/objects/items/robot/robot_items.dm | 2 +-
code/game/objects/items/stunbaton.dm | 2 +-
code/game/objects/items/twohanded.dm | 2 +-
.../abductor/equipment/abduction_gear.dm | 2 +-
.../carbon/alien/humanoid/caste/hunter.dm | 6 +--
.../mob/living/carbon/carbon_defense.dm | 1 -
.../mob/living/carbon/human/human_defense.dm | 24 ---------
.../mob/living/carbon/human/species.dm | 4 +-
code/modules/mob/living/living_block.dm | 51 +++++++++++++++----
code/modules/mob/living/living_defense.dm | 32 ++++++------
.../mob/living/silicon/silicon_defense.dm | 5 +-
.../simple_animal/guardian/types/charger.dm | 2 +-
.../living/silicon/robot/dogborg_equipment.dm | 6 +--
18 files changed, 77 insertions(+), 70 deletions(-)
diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm
index a4964103d4..577c31066a 100644
--- a/code/__DEFINES/combat.dm
+++ b/code/__DEFINES/combat.dm
@@ -229,3 +229,5 @@ GLOBAL_LIST_INIT(shove_disarming_types, typecacheof(list(
#define BLOCK_SHOULD_PASSTHROUGH (1<<6)
/// Attack outright missed because the target dodged. Should usually be combined with SHOULD_PASSTHROUGH or something (see martial arts)
#define BLOCK_TARGET_DODGED (1<<7)
+/// Meta-flag for run_block/do_run_block : Whatever triggered this has completely blocked the attack (or failed so miserably hard it wants us to stop for when that's implemented), do not keep checking.
+#define BLOCK_STOP_CHAIN (1<<8)
diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm
index c4e57154c2..364ed65415 100644
--- a/code/__DEFINES/dcs/signals.dm
+++ b/code/__DEFINES/dcs/signals.dm
@@ -186,6 +186,7 @@
#define COMSIG_LIVING_REVIVE "living_revive" //from base of mob/living/revive() (full_heal, admin_revive)
#define COMSIG_MOB_CLIENT_LOGIN "comsig_mob_client_login" //sent when a mob/login() finishes: (client)
#define COMSIG_LIVING_GUN_PROCESS_FIRE "living_gun_process_fire" //from base of /obj/item/gun/proc/process_fire(): (atom/target, params, zone_override)
+#define COMSIG_LIVING_RUN_BLOCK "living_do_run_block" //from base of mob/living/do_run_block(): (real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone)
//ALL OF THESE DO NOT TAKE INTO ACCOUNT WHETHER AMOUNT IS 0 OR LOWER AND ARE SENT REGARDLESS!
#define COMSIG_LIVING_STATUS_STUN "living_stun" //from base of mob/living/Stun() (amount, update, ignore)
diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm
index 2fa2a8e85f..aa75374bcf 100644
--- a/code/_onclick/item_attack.dm
+++ b/code/_onclick/item_attack.dm
@@ -116,7 +116,7 @@
if(!CHECK_MOBILITY(user, MOBILITY_STAND))
totitemdamage *= 0.5
//CIT CHANGES END HERE
- if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration))
+ if((user != src) && run_block(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration, user) & BLOCK_SUCCESS)
return FALSE
send_item_attack_message(I, user)
if(I.force)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index beddf28d39..8bf732da62 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -87,7 +87,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
var/tool_behaviour = NONE
var/toolspeed = 1
- var/block_chance = 0
var/reach = 1 //In tiles, how far this weapon can reach; 1 for adjacent, which is default
//The list of slots by priority. equip_to_appropriate_slot() uses this list. Doesn't matter if a mob type doesn't have a slot.
diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm
index 8e93aa4fb4..e99ca83a97 100644
--- a/code/game/objects/items/melee/misc.dm
+++ b/code/game/objects/items/melee/misc.dm
@@ -277,7 +277,7 @@
return
else
if(cooldown_check < world.time)
- if(target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
+ if(target.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS)
playsound(target, 'sound/weapons/genhit.ogg', 50, 1)
return
if(ishuman(target))
diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm
index fe1f3ebd6c..74ef81be24 100644
--- a/code/game/objects/items/robot/robot_items.dm
+++ b/code/game/objects/items/robot/robot_items.dm
@@ -11,7 +11,7 @@
var/charge_cost = 30
/obj/item/borg/stun/attack(mob/living/M, mob/living/user)
- if(M.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK))
+ if(M.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK, 0, user, ran_zone(user.zone_selected)) & BLOCK_SUCCESS)
playsound(M, 'sound/weapons/genhit.ogg', 50, 1)
return FALSE
if(iscyborg(user))
diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm
index 3079c3cad9..74a2b148fd 100644
--- a/code/game/objects/items/stunbaton.dm
+++ b/code/game/objects/items/stunbaton.dm
@@ -172,7 +172,7 @@
return disarming || (user.a_intent != INTENT_HARM)
/obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user, disarming = FALSE)
- if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
+ if(L.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS) //No message; check_shields() handles that
playsound(L, 'sound/weapons/genhit.ogg', 50, 1)
return FALSE
var/stunpwr = stamforce
diff --git a/code/game/objects/items/twohanded.dm b/code/game/objects/items/twohanded.dm
index 57fc99c663..43736e5244 100644
--- a/code/game/objects/items/twohanded.dm
+++ b/code/game/objects/items/twohanded.dm
@@ -1180,7 +1180,7 @@
if(iscyborg(target))
..()
return
- if(target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that
+ if(target.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS) //No message; check_shields() handles that
playsound(target, 'sound/weapons/genhit.ogg', 50, 1)
return FALSE
if(user.a_intent != INTENT_HARM)
diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
index 39cdf8a5fa..468c14278b 100644
--- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm
+++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm
@@ -493,7 +493,7 @@
user.do_attack_animation(L)
- if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK))
+ if(L.run_block(src, 0, "[user]'s [src]", MELEE_ATTACK, 0, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS)
playsound(L, 'sound/weapons/genhit.ogg', 50, TRUE)
return FALSE
diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
index e0647159a5..189af32da8 100644
--- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
+++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm
@@ -63,13 +63,13 @@
if(hit_atom)
if(isliving(hit_atom))
var/mob/living/L = hit_atom
- if(!L.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK))
+ if(L.run_block(src, 0, "the [name]", attack_type = LEAP_ATTACK, 0, src) & BLOCK_SUCCESS)
+ DefaultCombatKnockdown(40, 1, 1)
+ else
L.visible_message("[src] pounces on [L]!", "[src] pounces on you!")
L.DefaultCombatKnockdown(100)
sleep(2)//Runtime prevention (infinite bump() calls on hulks)
step_towards(src,L)
- else
- DefaultCombatKnockdown(40, 1, 1)
toggle_leap(0)
else if(hit_atom.density && !hit_atom.CanPass(src))
diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm
index 65eda88a44..6e78924dd3 100644
--- a/code/modules/mob/living/carbon/carbon_defense.dm
+++ b/code/modules/mob/living/carbon/carbon_defense.dm
@@ -89,7 +89,6 @@
totitemdamage *= 1.5
//CIT CHANGES END HERE
var/impacting_zone = (user == src)? check_zone(user.zone_selected) : ran_zone(user.zone_selected)
-#warn Implement passthrough/reflect/blocktypes.
if((user != src) && (run_block(I, totitemdamage, "the [I]", MELEE_ATTACK, I.armour_penetration, user, impacting_zone) & BLOCK_SUCCESS))
return FALSE
var/obj/item/bodypart/affecting = get_bodypart(impacting_zone)
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 1fc43f0d41..90eb48cbfd 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -52,30 +52,6 @@
return martial_art_result
return ..()
-/mob/living/carbon/human/check_reflect(def_zone)
- if(wear_suit?.IsReflect(def_zone))
- return TRUE
- return ..()
-
-/mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0)
- . = ..()
- if(.)
- return
- var/block_chance_modifier = round(damage / -3)
- if(wear_suit)
- var/final_block_chance = wear_suit.block_chance - (CLAMP((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
- if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
- return TRUE
- if(w_uniform)
- var/final_block_chance = w_uniform.block_chance - (CLAMP((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
- if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
- return TRUE
- if(wear_neck)
- var/final_block_chance = wear_neck.block_chance - (CLAMP((armour_penetration-wear_neck.armour_penetration)/2,0,100)) + block_chance_modifier
- if(wear_neck.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
- return TRUE
- return FALSE
-
/mob/living/carbon/human/can_embed(obj/item/I)
if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types))
return TRUE
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index b428f49578..d4bfe90707 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1668,7 +1668,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
/datum/species/proc/spec_attacked_by(obj/item/I, mob/living/user, obj/item/bodypart/affecting, intent, mob/living/carbon/human/H)
// Allows you to put in item-specific reactions based on species
if(user != H)
- if(H.check_shields(I, I.force, "the [I.name]", MELEE_ATTACK, I.armour_penetration))
+ if(H.run_block(I, I.force, "the [I.name]", MELEE_ATTACK, I.armour_penetration, user, affecting.body_zone) & BLOCK_SUCCESS)
return 0
if(H.check_block())
H.visible_message("[H] blocks [I]!")
@@ -1786,7 +1786,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
return TRUE
if(M.mind)
attacker_style = M.mind.martial_art
- if((M != H) && M.a_intent != INTENT_HELP && H.check_shields(M, 0, M.name, attack_type = UNARMED_ATTACK))
+ if((M != H) && M.a_intent != INTENT_HELP && (H.run_block(M, 0, "[M]", UNARMED_ATTACK, 0, M, M.zone_selected) & BLOCK_SUCCESS))
log_combat(M, H, "attempted to touch")
H.visible_message("[M] attempted to touch [H]!")
return TRUE
diff --git a/code/modules/mob/living/living_block.dm b/code/modules/mob/living/living_block.dm
index 18143ec15d..df68cb1098 100644
--- a/code/modules/mob/living/living_block.dm
+++ b/code/modules/mob/living/living_block.dm
@@ -25,14 +25,14 @@
///Check whether or not we can block, without "triggering" a block. Basically run checks without effects like depleting shields. Wrapper for do_run_block(). The arguments on that means the same as for this.
/mob/living/proc/check_block(atom/object, damage, attack_text = "the attack", attack_type, armour_penetration, mob/attacker, def_zone)
- return do_run_block(FALSE, object, damage, attack_Text, attack_type, armour_penetration, attacker, def_zone)
+ return do_run_block(FALSE, object, damage, attack_Text, attack_type, armour_penetration, attacker, check_zone(def_zone))
/// Runs a block "sequence", effectively checking and then doing effects if necessary. Wrapper for do_run_block(). The arguments on that means the same as for this.
/mob/living/proc/run_block(atom/object, damage, attack_text = "the attack", attack_type, armour_penetration, mob/attacker, def_zone)
- return do_run_block(TRUE, object, damage, attack_Text, attack_type, armour_penetration, attacker, def_zone)
+ return do_run_block(TRUE, object, damage, attack_Text, attack_type, armour_penetration, attacker, check_zone(def_zone))
/** The actual proc for block checks. DO NOT USE THIS DIRECTLY UNLESS YOU HAVE VERY GOOD REASON TO. To reduce copypaste for differences between handling for real attacks and virtual checks.
- * Automatically checks all held items for /obj/item/proc/do_run_block() with the same parameters.
+ * Automatically checks all held items for /obj/item/proc/run_block() with the same parameters.
* @params
* real_attack - If this attack is real
* object - Whatever /atom is actually hitting us, in essence. For example, projectile if gun, item if melee, structure/whatever if it's a thrown, etc.
@@ -44,9 +44,17 @@
* def_zone - The zone this'll impact.
*/
/mob/living/proc/do_run_block(real_attack = TRUE, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone)
+ // Component signal block runs have highest priority.. for now.
+ . = SEND_SIGNAL(src, COMSIG_MOB_RUN_BLOCK, real_attack, object, damage, attack_text, attack_type, armour_penetration, attacker, def_zone)
+ if(. & BLOCK_INTERRUPT_CHAIN)
+ return
+ for(var/obj/item/I in held_items)
+ if(istype(I, /obj/item/clothing)) //yeah usually this shouldn't.. uh, work. This is a bad check and should be removed though.
+ continue
-/mob/living/proc/_check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0)
+
+/mob/living/proc/_check_shields()
var/block_chance_modifier = round(damage / -3)
for(var/obj/item/I in held_items)
if(!istype(I, /obj/item/clothing))
@@ -62,19 +70,42 @@
return FALSE
/obj/item
- var/hit_reaction_chance = 0 //The base chance at which hit_reaction() will be called.
+ /// The 0% to 100% chance for the default implementation of random block rolls.
+ var/block_chance = 0
-/obj/item/
+/obj/item/proc/run_block(real_attack, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance)
-
-/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
+/obj/item/proc/_hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
SEND_SIGNAL(src, COMSIG_ITEM_HIT_REACT, args)
if(prob(final_block_chance))
owner.visible_message("[owner] blocks [attack_text] with [src]!")
return 1
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
+/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
- 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
+
+/mob/living/carbon/human/check_reflect(def_zone)
+ if(wear_suit?.IsReflect(def_zone))
+ return TRUE
+ return ..()
+
+/mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0)
+ . = ..()
+ if(.)
+ return
+ var/block_chance_modifier = round(damage / -3)
+ if(wear_suit)
+ var/final_block_chance = wear_suit.block_chance - (CLAMP((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
+ if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
+ return TRUE
+ if(w_uniform)
+ var/final_block_chance = w_uniform.block_chance - (CLAMP((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
+ if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
+ return TRUE
+ if(wear_neck)
+ var/final_block_chance = wear_neck.block_chance - (CLAMP((armour_penetration-wear_neck.armour_penetration)/2,0,100)) + block_chance_modifier
+ if(wear_neck.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
+ return TRUE
+ return FALSE
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 5940cb4728..cf008d019c 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -36,7 +36,7 @@
/mob/living/proc/on_hit(obj/item/projectile/P)
return BULLET_ACT_HIT
-/mob/living/proc/reflect_bullet_check(obj/item/projectile/P, def_zone)
+/mob/living/proc/_reflect_bullet_check(obj/item/projectile/P, def_zone)
if(P.is_reflectable && check_reflect(def_zone)) // Checks if you've passed a reflection% check
visible_message("The [P.name] gets reflected by [src]!", \
"The [P.name] gets reflected by [src]!")
@@ -62,7 +62,7 @@
if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself
if(reflect_bullet_check(P, def_zone))
return BULLET_ACT_FORCE_PIERCE // complete projectile permutation
- if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
+ if(run_block(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration, P.firer, def_zone) & BLOCK_SUCCESS)
P.on_hit(src, 100, def_zone)
return BULLET_ACT_BLOCK
var/armor = run_armor_check(def_zone, P.flag, null, null, P.armour_penetration, null)
@@ -98,7 +98,8 @@
if(isitem(AM))
I = AM
throwpower = I.throwforce
- if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK))
+ var/impacting_zone = ran_zone(BODY_ZONE_CHEST, 65)//Hits a random part of the body, geared towards the chest
+ if(run_block(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK, throwningdatum.thrower, impacting_zone) & BLOCK_SUCCESS)
hitpush = FALSE
skipcatch = TRUE
blocked = TRUE
@@ -109,10 +110,9 @@
if(I)
if(!skipcatch && isturf(I.loc) && catch_item(I))
return TRUE
- var/zone = ran_zone(BODY_ZONE_CHEST, 65)//Hits a random part of the body, geared towards the chest
var/dtype = BRUTE
var/volume = I.get_volume_by_throwforce_and_or_w_class()
- SEND_SIGNAL(I, COMSIG_MOVABLE_IMPACT_ZONE, src, zone)
+ SEND_SIGNAL(I, COMSIG_MOVABLE_IMPACT_ZONE, src, impacting_zone)
dtype = I.damtype
if (I.throwforce > 0) //If the weapon's throwforce is greater than zero...
@@ -130,8 +130,8 @@
if(!blocked)
visible_message("[src] has been hit by [I].", \
"[src] has been hit by [I].")
- var/armor = run_armor_check(zone, "melee", "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].",I.armour_penetration)
- apply_damage(I.throwforce, dtype, zone, armor)
+ var/armor = run_armor_check(impacting_zone, "melee", "Your armor has protected your [parse_zone(impacting_zone)].", "Your armor has softened hit to your [parse_zone(impacting_zone)].",I.armour_penetration)
+ apply_damage(I.throwforce, dtype, impacting_zone, armor)
if(I.thrownby)
log_combat(I.thrownby, src, "threw and hit", I)
else
@@ -268,7 +268,7 @@
/mob/living/attack_hand(mob/user)
..() //Ignoring parent return value here.
SEND_SIGNAL(src, COMSIG_MOB_ATTACK_HAND, user)
- if((user != src) && user.a_intent != INTENT_HELP && check_shields(user, 0, user.name, attack_type = UNARMED_ATTACK))
+ if((user != src) && user.a_intent != INTENT_HELP && (run_block(user, 0, user.name, UNARMED_ATTACK | MELEE_ATTACK, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS))
log_combat(user, src, "attempted to touch")
visible_message("[user] attempted to touch [src]!")
return TRUE
@@ -279,7 +279,7 @@
to_chat(user, "You don't want to hurt [src]!")
return TRUE
var/hulk_verb = pick("smash","pummel")
- if(user != src && check_shields(user, 15, "the [hulk_verb]ing"))
+ if(user != src && (run_block(user, 15, "the [hulk_verb]ing", MELEE_ATTACK, null, user, check_zone(user.zone_selected)) & BLOCK_SUCCESS))
return TRUE
..()
return FALSE
@@ -294,14 +294,14 @@
M.Feedstop()
return // can't attack while eating!
- if(HAS_TRAIT(src, TRAIT_PACIFISM))
+ if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
return FALSE
var/damage = rand(5, 35)
if(M.is_adult)
damage = rand(20, 40)
- if(check_shields(M, damage, "the [M.name]"))
+ if(run_block(M, damage, "the [M.name]", MELEE_ATTACK, null, M, check_zone(user.zone_selected)) & BLOCK_SUCCESS)
return FALSE
if (stat != DEAD)
@@ -320,7 +320,7 @@
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
return FALSE
- if(check_shields(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration))
+ if(run_block(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS)
return FALSE
if(M.attack_sound)
playsound(loc, M.attack_sound, 50, 1, 1)
@@ -330,17 +330,15 @@
log_combat(M, src, "attacked")
return TRUE
-
/mob/living/attack_paw(mob/living/carbon/monkey/M)
if (M.a_intent == INTENT_HARM)
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
return FALSE
-
if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH))
to_chat(M, "You can't bite with your mouth covered!")
return FALSE
- if(check_shields(M, 0, "the [M.name]"))
+ if(run_block(M, 0, "the [M.name]", MELEE_ATTACK | UNARMED_ATTACK, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS)
return FALSE
M.do_attack_animation(src, ATTACK_EFFECT_BITE)
if (prob(75))
@@ -364,7 +362,7 @@
if(HAS_TRAIT(L, TRAIT_PACIFISM))
to_chat(L, "You don't want to hurt anyone!")
return FALSE
- if(L != src && check_shields(L, rand(1, 3), "the [L.name]"))
+ if(L != src && (run_block(L, rand(1, 3), "the [L.name]", ATTACK_TYPE_MELEE | ATTACK_TYPE_UNARMED, L, check_zone(L.zone_selected)) & BLOCK_SUCCESS))
return FALSE
L.do_attack_animation(src)
if(prob(90))
@@ -378,7 +376,7 @@
"[L.name] has attempted to bite [src]!", null, COMBAT_MESSAGE_RANGE)
/mob/living/attack_alien(mob/living/carbon/alien/humanoid/M)
- if((M != src) && M.a_intent != INTENT_HELP && check_shields(M, 0, "the [M.name]"))
+ if((M != src) && M.a_intent != INTENT_HELP && (run_block(M, 0, "the [M.name]", MELEE_ATTACK | ATTACK_TYPE_UNARMED, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS))
visible_message("[M] attempted to touch [src]!")
return FALSE
switch(M.a_intent)
diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm
index a93bc8662e..e1ad55af84 100644
--- a/code/modules/mob/living/silicon/silicon_defense.dm
+++ b/code/modules/mob/living/silicon/silicon_defense.dm
@@ -114,9 +114,10 @@
if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself
if(reflect_bullet_check(P, def_zone))
return -1 // complete projectile permutation
- if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration))
+#warn implement blocktypes
+ if(run_block(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration) & BLOCK_SUCCESS)
P.on_hit(src, 100, def_zone)
- return 2
+ return BULLET_ACT_BLOCKED
if((P.damage_type == BRUTE || P.damage_type == BURN))
adjustBruteLoss(P.damage)
if(prob(P.damage*1.5))
diff --git a/code/modules/mob/living/simple_animal/guardian/types/charger.dm b/code/modules/mob/living/simple_animal/guardian/types/charger.dm
index 237ab9d919..10f7b6893f 100644
--- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm
+++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm
@@ -54,7 +54,7 @@
var/blocked = FALSE
if(hasmatchingsummoner(hit_atom)) //if the summoner matches don't hurt them
blocked = TRUE
- if(L.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK))
+ if(L.run_block(src, 90, "[name]", attack_type = ATTACK_TYPE_LEAP, 0, src) & BLOCK_SUCCESS)
blocked = TRUE
if(!blocked)
L.drop_all_held_items()
diff --git a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
index 6d080ee898..5cf4abb5bf 100644
--- a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
+++ b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm
@@ -424,15 +424,15 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
if(hit_atom)
if(isliving(hit_atom))
var/mob/living/L = hit_atom
- if(!L.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK))
+ if(L.run_block(0, "the [name]", src, attack_type = LEAP_ATTACK, 0, src) & BLOCK_SUCCESS)
+ DefaultCombatKnockdown(15, 1, 1)
+ else
L.visible_message("[src] pounces on [L]!", "[src] pounces on you!")
L.DefaultCombatKnockdown(iscarbon(L) ? 60 : 45, override_stamdmg = CLAMP(pounce_stamloss, 0, pounce_stamloss_cap-L.getStaminaLoss())) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice.
playsound(src, 'sound/weapons/Egloves.ogg', 50, 1)
sleep(2)//Runtime prevention (infinite bump() calls on hulks)
step_towards(src,L)
log_combat(src, L, "borg pounced")
- else
- DefaultCombatKnockdown(15, 1, 1)
pounce_cooldown = !pounce_cooldown
spawn(pounce_cooldown_time) //3s by default