diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index aa75374bcf..d78cc01963 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) && run_block(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration, user) & BLOCK_SUCCESS) + if((user != src) && run_block(I, totitemdamage, "the [I.name]", ATTACK_TYPE_MELEE, I.armour_penetration, user) & BLOCK_SUCCESS) return FALSE send_item_attack_message(I, user) if(I.force) diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index 0c144ff1d6..e2140bd0fd 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -235,7 +235,7 @@ create_with_tank = TRUE /obj/item/flamethrower/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(real_attack && (attack_type & ATTACK_TYPE_PROJECTILE)) + if(attack_type & ATTACK_TYPE_PROJECTILE) var/obj/item/projectile/P = object if(istype(P) && (P.damage_type != STAMINA) && damage && !P.nodamage && prob(15)) owner.visible_message("\The [attack_text] hits the fueltank on [owner]'s [name], rupturing it! What a shot!") diff --git a/code/game/objects/items/grenades/grenade.dm b/code/game/objects/items/grenades/grenade.dm index 9f098e21b6..8a41ee4601 100644 --- a/code/game/objects/items/grenades/grenade.dm +++ b/code/game/objects/items/grenades/grenade.dm @@ -116,7 +116,7 @@ return attack_hand(user) /obj/item/grenade/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(real_attack && (attack_type & ATTACK_TYPE_PROJECTILE)) + if(attack_type & ATTACK_TYPE_PROJECTILE) var/obj/item/projectile/P = object if(damage && !P.nodamage && (P.damage_type != STAMINA) && prob(15)) owner.visible_message("[attack_text] hits [owner]'s [src], setting it off! What a shot!") diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 74a2b148fd..a4ff631b07 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.run_block(src, 0, "[user]'s [name]", MELEE_ATTACK, 0, user) & BLOCK_SUCCESS) //No message; check_shields() handles that + if(L.run_block(src, 0, "[user]'s [name]", ATTACK_TYPE_MELEE, 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/weaponry.dm b/code/game/objects/items/weaponry.dm index 6c23683325..c40a4c0e43 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -588,7 +588,7 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 if(is_energy_reflectable_projectile(object) && (attack_type == ATTACK_TYPE_PROJECTILE)) var/turf = get_turf(src) playsound(turf, pick('sound/weapons/effects/batreflect1.ogg', 'sound/weapons/effects/batreflect2.ogg'), 50, 1) - return BLOCK_SUCESS | BLOCK_SHOULD_REDIRECT | BLOCK_PHYSICAL_EXTERNAL | BLOCK_REDIRECTED + return BLOCK_SUCCESS | BLOCK_SHOULD_REDIRECT | BLOCK_PHYSICAL_EXTERNAL | BLOCK_REDIRECTED return ..() /obj/item/melee/baseball_bat/ablative/syndi diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 61fad9084c..12a4ca07c4 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -412,7 +412,7 @@ /obj/item/clothing/suit/hooded/cultrobes/cult_shield/check_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) if(current_charges) - block_return[BLOCK_RETURN_GENERAL_BLOCK_CHANCE] = 100 + block_return[BLOCK_RETURN_NORMAL_BLOCK_CHANCE] = 100 block_return[BLOCK_RETURN_BLOCK_CAPACITY] = (block_return[BLOCK_RETURN_BLOCK_CAPACITY] || 0) + current_charges return ..() @@ -945,7 +945,10 @@ /obj/item/shield/mirror/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(iscultist(owner)) if(istype(object, /obj/item/projectile) && (attack_type == ATTACK_TYPE_PROJECTILE)) - var/obj/item/projectile/P = object + if(is_energy_reflectable_projectile(object)) + if(prob(final_block_chance)) + return BLOCK_SUCCESS | BLOCK_SHOULD_REDIRECT | BLOCK_PHYSICAL_EXTERNAL | BLOCK_REDIRECTED + return BLOCK_NONE //To avoid reflection chance double-dipping with block chance var/obj/item/projectile/P = object if(P.damage >= 30) var/turf/T = get_turf(owner) T.visible_message("The sheer force from [P] shatters the mirror shield!") @@ -954,10 +957,6 @@ owner.DefaultCombatKnockdown(25) qdel(src) return BLOCK_NONE - if(P.is_reflectable) - if(prob(final_block_chance)) - return BLOCK_SUCCESS | BLOCK_SHOULD_REDIRECT | BLOCK_PHYSICAL_EXTERNAL | BLOCK_REDIRECTED - return BLOCK_NONE //To avoid reflection chance double-dipping with block chance . = ..() if(. & BLOCK_SUCCESS) playsound(src, 'sound/weapons/parry.ogg', 100, 1) @@ -991,11 +990,6 @@ var/mob/living/holder = loc to_chat(holder, "The shield's illusions are back at full strength!") -/obj/item/shield/mirror/IsReflect() - if(prob(block_chance)) - return TRUE - return FALSE - /obj/item/shield/mirror/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) var/turf/T = get_turf(hit_atom) var/datum/thrownthing/D = throwingdatum diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm index e9d4ee34dc..455030f2e3 100644 --- a/code/modules/clothing/spacesuits/hardsuit.dm +++ b/code/modules/clothing/spacesuits/hardsuit.dm @@ -759,7 +759,7 @@ /obj/item/clothing/suit/space/hardsuit/shielded/check_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return) if(current_charges > 0) - block_return[BLOCK_RETURN_GENERAL_BLOCK_CHANCE] = 100 + block_return[BLOCK_RETURN_NORMAL_BLOCK_CHANCE] = 100 block_return[BLOCK_RETURN_BLOCK_CAPACITY] = (block_return[BLOCK_RETURN_BLOCK_CAPACITY] || 0) + current_charges return ..() diff --git a/code/modules/clothing/spacesuits/miscellaneous.dm b/code/modules/clothing/spacesuits/miscellaneous.dm index 8c39427c49..b01fe5eb8e 100644 --- a/code/modules/clothing/spacesuits/miscellaneous.dm +++ b/code/modules/clothing/spacesuits/miscellaneous.dm @@ -456,7 +456,8 @@ Contains: armor = list("melee" = 5, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 10, "fire" = 0, "acid" = 0) strip_delay = 65 -/obj/item/clothing/suit/space/fragile/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/clothing/suit/space/fragile/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(!torn && prob(50) && damage >= 5) to_chat(owner, "[src] tears from the damage, breaking the air-tight seal!") clothing_flags &= ~STOPSPRESSUREDAMAGE diff --git a/code/modules/clothing/under/color.dm b/code/modules/clothing/under/color.dm index 43b54f15b5..be6ae26142 100644 --- a/code/modules/clothing/under/color.dm +++ b/code/modules/clothing/under/color.dm @@ -81,7 +81,7 @@ /obj/item/clothing/under/color/grey/glorf/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(real_attack && ishuman(owner)) + if(ishuman(owner)) var/mob/living/human/H = owner H.forcesay(GLOB.hit_appends) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 0794fcefac..c152bcf3a7 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -377,7 +377,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 && (run_block(M, 0, "the [M.name]", MELEE_ATTACK | ATTACK_TYPE_UNARMED, M, check_zone(M.zone_selected)) & BLOCK_SUCCESS)) + if((M != src) && M.a_intent != INTENT_HELP && (run_block(M, 0, "the [M.name]", ATTACK_TYPE_MELEE | 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/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 686e44cba1..ac7043298e 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -690,3 +690,9 @@ /obj/item/projectile/experience_pressure_difference() return + +/////// MISC HELPERS //////// +/// Is this atom reflectable with ""standardized"" reflection methods like you know eshields and deswords and similar +/proc/is_energy_reflectable_projectile(atom/A) + var/obj/item/projectile/P = A + return istype(P) && P.is_reflectable