Files
Bubberstation/code/modules/unit_tests/combat_blocking.dm
MrMelbert 34d35c6048 Adds a bunch of interaction related unit tests (#88210)
## About The Pull Request

I made these a year ago and meant to PR them but never got around to it

Basically just adds a bunch of unit tests for a bunch of specific attack
chain interactions that are prone to breaking due to snowflake

Increasing coverage of attack chain is good so people who are working on
it don't have to worry about the 1000 edge cases breaking

- Blocking (both unarmed and armed)
- Cuffs
- Eyestab
- Flashes (combat mode, non combat mode, with flash protection)
- Help intent
- Pistol whip
- Butchering with a bayonet 
- Damp rag smothering
- Droppers
- EMP flashlights
- Holofans
- Door attack hand redirector
- Tool usage on Cyborgs
- Punching Cyborgs
- Ability to bash tables
- Ability to bash any structure
- Ability to use tools on machinery
- Kinetic Crusher projectile
- Spraycans (capping, making graffiti) 
- Loading a syringe gun
2024-11-27 11:38:43 -07:00

36 lines
1.6 KiB
Plaintext

/// Test that items can block unarmed attacks
/datum/unit_test/unarmed_blocking
/datum/unit_test/unarmed_blocking/Run()
var/mob/living/carbon/human/consistent/attacker = EASY_ALLOCATE()
var/mob/living/carbon/human/consistent/victim = EASY_ALLOCATE()
var/obj/item/chair/chair = EASY_ALLOCATE()
chair.hit_reaction_chance = 100
victim.put_in_active_hand(chair, forced = TRUE)
attacker.set_combat_mode(TRUE)
ADD_TRAIT(attacker, TRAIT_PERFECT_ATTACKER, TRAIT_SOURCE_UNIT_TESTS)
click_wrapper(attacker, victim)
TEST_ASSERT_EQUAL(victim.getBruteLoss(), 0, "Victim took damage from being punched despite having a 100% block chance chair in their hands.")
/// Test that items can block weapon attacks
/datum/unit_test/armed_blocking
/datum/unit_test/armed_blocking/Run()
var/mob/living/carbon/human/consistent/attacker = EASY_ALLOCATE()
var/mob/living/carbon/human/consistent/victim = EASY_ALLOCATE()
var/obj/item/shield/riot/shield = EASY_ALLOCATE()
shield.block_chance = INFINITY
victim.put_in_active_hand(shield, forced = TRUE)
attacker.set_combat_mode(TRUE)
ADD_TRAIT(attacker, TRAIT_PERFECT_ATTACKER, TRAIT_SOURCE_UNIT_TESTS)
click_wrapper(attacker, victim)
TEST_ASSERT_EQUAL(victim.getBruteLoss(), 0, "Victim took damage from being punched despite having a 100% block chance shield in their hands.")
var/obj/item/storage/toolbox/weapon = EASY_ALLOCATE()
attacker.put_in_active_hand(weapon, forced = TRUE)
click_wrapper(attacker, victim)
TEST_ASSERT_EQUAL(victim.getBruteLoss(), 0, "Victim took damage from being hit with a weapon despite having a 100% block chance shield in their hands.")