Files
Bubberstation/code/modules/unit_tests/hunger_curse.dm
SkyratBot 5ffc3c2dc8 [MIRROR] Fixes cursed duffelbag's permanent curse (again), unit tests it. [MDB IGNORE] (#18146)
* Fixes cursed duffelbag's permanent curse (again), unit tests it. (#71969)

## About The Pull Request

Curse of hunger did some funky stuff by checking for
`slot_equipment_priority` (which ONLY BUCKETS use) and registering
certain signals based on that

The signals they were using instead didn't pass the unequipper, so the
curse never got removed on unequip.

Replaced them with just equip and drop, as equipped and dropped work
just fine for it.

Unit tests this.

## Why It's Good For The Game

Infinite curse of clumsy and pacifism is kinda bad

## Changelog

🆑 Melbert
fix: Dufflebag Curse no longer lasts forever after the bag is destroyed.
fix: Dufflebag Cursing someone already afflicted properly doesn't try to
add the curse again
/🆑

* Fixes cursed duffelbag's permanent curse (again), unit tests it.

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
2022-12-14 22:39:53 -08:00

19 lines
1003 B
Plaintext

/// Tests that the curse of hunger, from [/datum/component/curse_of_hunger],
/// is properly added when equipped to the correct slot and removed when dropped / deleted
/datum/unit_test/hunger_curse
/datum/unit_test/hunger_curse/Run()
var/mob/living/carbon/human/dummy = allocate(/mob/living/carbon/human/consistent)
var/obj/item/storage/backpack/duffelbag/cursed/cursed_bag = allocate(/obj/item/storage/backpack/duffelbag/cursed)
dummy.equip_to_appropriate_slot(cursed_bag)
TEST_ASSERT(HAS_TRAIT(cursed_bag, TRAIT_NODROP), "The cursed bag wasn't NODROP after being cursed!")
TEST_ASSERT(HAS_TRAIT(dummy, TRAIT_CLUMSY), "Dummy wasn't clumsy after being cursed!")
TEST_ASSERT(HAS_TRAIT(dummy, TRAIT_PACIFISM), "Dummy wasn't a pacifist after being cursed!")
QDEL_NULL(cursed_bag)
TEST_ASSERT(!HAS_TRAIT(dummy, TRAIT_CLUMSY), "Dummy was still clumsy after being cured of its curse!")
TEST_ASSERT(!HAS_TRAIT(dummy, TRAIT_PACIFISM), "Dummy was still a pacifist after being cured of its curse!")