Fixes being able to punch yourself (#79033)

## About The Pull Request

Fixes #79031 

Fixes #79042

I forgot some logic here when making the human override. 
Not the cleanest way to do it but it'll suffice. 

## Changelog

🆑 Melbert
fix: You can punch yourself again
/🆑
This commit is contained in:
MrMelbert
2023-10-17 13:02:07 -06:00
committed by GitHub
parent 9bb75adc5c
commit dcedf89c70
6 changed files with 48 additions and 10 deletions
+39
View File
@@ -99,3 +99,42 @@
TEST_ASSERT_EQUAL(victim.loc.x, run_loc_floor_bottom_left.x + 2, "Victim was moved after being pushed against a wall")
TEST_ASSERT(victim.has_status_effect(/datum/status_effect/incapacitating/knockdown), "Victim was not knocked down after being pushed against a wall")
TEST_ASSERT_EQUAL(victim.get_active_held_item(), null, "Victim didn't drop toolbox after being pushed against a wall")
/// Tests you can punch yourself
/datum/unit_test/self_punch
/datum/unit_test/self_punch/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
ADD_TRAIT(dummy, TRAIT_PERFECT_ATTACKER, TRAIT_SOURCE_UNIT_TESTS)
dummy.set_combat_mode(TRUE)
dummy.ClickOn(dummy)
TEST_ASSERT_NOTEQUAL(dummy.getBruteLoss(), 0, "Dummy took no brute damage after self-punching")
/// Tests handcuffed (HANDS_BLOCKED) mobs cannot punch
/datum/unit_test/handcuff_punch
/datum/unit_test/handcuff_punch/Run()
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
ADD_TRAIT(attacker, TRAIT_PERFECT_ATTACKER, TRAIT_SOURCE_UNIT_TESTS)
ADD_TRAIT(attacker, TRAIT_HANDS_BLOCKED, TRAIT_SOURCE_UNIT_TESTS)
attacker.set_combat_mode(TRUE)
attacker.ClickOn(victim)
TEST_ASSERT_EQUAL(victim.getBruteLoss(), 0, "Victim took brute damage from being punched by a handcuffed attacker")
attacker.next_move = -1
attacker.next_click = -1
attacker.ClickOn(attacker)
TEST_ASSERT_EQUAL(attacker.getBruteLoss(), 0, "Attacker took brute damage from self-punching while handcuffed")
/// Tests handcuffed (HANDS_BLOCKED) monkeys can still bite despite being cuffed
/datum/unit_test/handcuff_bite
/datum/unit_test/handcuff_bite/Run()
var/mob/living/carbon/human/attacker = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/victim = allocate(/mob/living/carbon/human/consistent)
ADD_TRAIT(attacker, TRAIT_PERFECT_ATTACKER, TRAIT_SOURCE_UNIT_TESTS)
ADD_TRAIT(attacker, TRAIT_HANDS_BLOCKED, TRAIT_SOURCE_UNIT_TESTS)
attacker.set_combat_mode(TRUE)
attacker.set_species(/datum/species/monkey)
attacker.ClickOn(victim)
TEST_ASSERT_NOTEQUAL(victim.getBruteLoss(), 0, "Victim took no brute damage from being bit by a handcuffed monkey, which is incorrect, as it's a bite attack")