Files
Bubberstation/code/modules/unit_tests/spell_mindswap.dm
SkyratBot 8e7ec57fd2 [MIRROR] Kicks Martial Arts out of the attack chain (yippee), makes it use signals, plus a large clean up of existing martial arts (#26328)
Kicks Martial Arts out of the attack chain (yippee), makes it use signals, plus a large clean up of existing martial arts (#81097)

- Kicks Martial Arts out of the attack chain.
- All Martial Arts attacks are now handled via unarmed attack or grab
signals
- This means all martial arts are now technically on the living level,
allowing any mob that can unarmed attack to martial arts. Sort of. YMMV.

- All martial arts block checking is now handled by the arts themselves,
meaning you can selectively decide for a martial arts strike to not be
blocked. Maybe good for the future.

- A comprehensive cleanup of all existing martial arts. Improving var
names, code, adding some missing animation calls, etc.

Fixes #74829

Untangles the mess that is martial arts, making it a lot easier to work
with the attack chain and making it overall a ton more consistent.

🆑 Melbert
refactor: Big martial arts refactor, they should now overall act a ton
more consistent. Also technically any mob can do martial arts. Let me
know if something is funky.
/🆑

---------

Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2024-02-02 21:28:23 +01:00

46 lines
2.1 KiB
Plaintext

/**
* Validates that the mind swap spell
* properly transfers minds between a caster and a target.
*
* Also checks that the mindswap spell itself was transferred over
* to the new body on cast.
*/
/datum/unit_test/mind_swap_spell
/datum/unit_test/mind_swap_spell/Run()
var/mob/living/carbon/human/swapper = allocate(/mob/living/carbon/human/consistent)
var/mob/living/carbon/human/to_swap = allocate(/mob/living/carbon/human/consistent)
swapper.real_name = "The Mindswapper"
swapper.name = swapper.real_name
to_swap.real_name = "The Guy Who Gets Mindswapped"
to_swap.name = to_swap.real_name
swapper.forceMove(run_loc_floor_bottom_left)
to_swap.forceMove(locate(run_loc_floor_bottom_left.x + 1, run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z))
swapper.mind_initialize()
to_swap.mind_initialize()
var/datum/mind/swapper_mind = swapper.mind
var/datum/mind/to_swap_mind = to_swap.mind
var/datum/action/cooldown/spell/pointed/mind_transfer/mind_swap = new(swapper.mind)
mind_swap.target_requires_key = FALSE
mind_swap.Grant(swapper)
// Perform a cast from the very base - mimics a click
var/result = mind_swap.InterceptClickOn(swapper, null, to_swap)
TEST_ASSERT(result, "[mind_swap] spell: Mind swap returned \"false\" from InterceptClickOn / cast, despite having valid conditions.")
TEST_ASSERT_EQUAL(swapper.mind, to_swap_mind, "[mind_swap] spell: Despite returning \"true\" on cast, swap failed to relocate the minds of the caster and the target.")
TEST_ASSERT_EQUAL(to_swap.mind, swapper_mind, "[mind_swap] spell: Despite returning \"true\" on cast, swap failed to relocate the minds of the target and the caster.")
var/datum/action/cooldown/spell/pointed/mind_transfer/should_be_null = locate() in swapper.actions
var/datum/action/cooldown/spell/pointed/mind_transfer/should_not_be_null = locate() in to_swap.actions
TEST_ASSERT(!isnull(should_not_be_null), "[mind_swap] spell: The spell was not transferred to the caster's new body, despite successful mind reolcation.")
TEST_ASSERT(isnull(should_be_null), "[mind_swap] spell: The spell remained on the caster's original body, despite successful mind relocation.")
qdel(mind_swap)