Files
Bubberstation/code/modules/unit_tests
EnterTheJake 7809f0f501 Introduces 6 New Heretic sideknowledges, 1 new spell to Blade Path. + changes to the Research Tree. (#89169)
## About The Pull Request

Introduces 6 new Heretic Sideknowledges.

**Warren King's Welcome:** Starting side-knowledge, Grants to the
Heretic's id Maints and External Airlock access.

**Phylactery Of Damnation:** T1 Knowledge, located between Imperfect
Ritual and Keykeeper's Burden, creates a bottle that can Siphon a small
quantity of blood from your victim, (they'll still feel a tiny prick).


![potion_red](https://github.com/user-attachments/assets/b000300a-2f2c-47f1-9fd3-b9d8e0f4f587)

**Ether Of The Newborn:** T2 knowledge, replaces Curse Of Paralysis slot
in the tree (Inbetween Mark of Madness and Moonlight Amulette).


![potion_green](https://github.com/user-attachments/assets/bc45c69f-4a16-4879-b788-661112e35638)

1 use potion, fully restores the inbiber to full health, removes any
sort of affliction,trauma,disease or implant at the cost of knocking the
user out for 1 minute.

**Codex Morbus:** T3 knowledge, located between Caretaker's Refuge and
Ringleader's RIse.


![codex
gif](https://github.com/user-attachments/assets/8a15dc78-30b9-4a21-93eb-bafbeebd59a4)


![Codex Morbius
Final](https://github.com/user-attachments/assets/04c8739c-5c65-4246-9408-3cbdbc57a164)


Upgrade of the Codex Cicatrix, draws and siphons runes and essences a
bit faster, can be used on a rune to curse a crewmember, provided their
blood is on the rune or on the Heretic.

**Greaves Of The Prophet:** T3 knowledge, located between Entropic Plume
and Wolves Among Sheep.



![Greaves](https://github.com/user-attachments/assets/287b592e-b771-40ed-99b3-25820550d6a0)

They work as magical magboots minus the slowdown; they confer full
immunity to slips (yes, even space lube).

**Rust Sower Grenade:** T2 knowledge, replaces curse of corrosion in the
tree (between Aggressive Spread and Star Blast).



![Rustsower](https://github.com/user-attachments/assets/297f045c-38c3-4ed0-9046-52d797610339)

Eldritch grenade, Releases a smoke that rusts all affected turfs, blinds
whoever doesn't have mask protection and utterly annihilates silicons,
mechs, augs and bots.

Video Showcase: https://www.youtube.com/watch?v=H1GeO7MYFek

**New Blade Path Spell: Wolves Among Sheep**

Video Showcase: https://www.youtube.com/watch?v=2LsmUiQzpzA

- Briefly transforms the surrounding the heretic into an arena.

- Both The Heretic and Crew members caught inside the spell cannot leave
or change z level until the spell expires.

- The arena is impassable to outsiders.

- Everyone caught inside the spell receives a special buff that makes
them immune to most enviromental hazards and all forms of Crowd Control
while blocking teleportation.

- Non Heretics are granted a temporary Heretic Blade and an antag datum.

- Scoring a critical hit grants the winner the ability to leave the
arena, Critting the heretic fully dissolves the spell.

- Critting yourself doesn't remove the debuff.

- The Heretic receives a heal upon critting someone.

- Breaking a blade while inside the arena will rip off your arm
regardless if you are crew or a Heretic.

- 2 minutes cooldown.

- Replaces Furious Steel as the last spell unlocked pre-ascension.


Lastly as you may have guessed, curses have been completely refactored,
they are now bound to the new item (Codex Morbus), are no longer
empowered by blood but require it as a reagent.

Curse of Corrosion and Paralysis have been rebalanced to be slightly
stronger than they were at their base value now that they can no longer
be empowered.

2 new curses have be introduced.

**Curse Of Indulgence:** tanks the target hunger, makes them a carnivore
and drastically increases their hunger decay rate, lasts 8 minutes.

**Curse Of Transmogrification:** Allows the Heretic to change the
target's Race(minus plasmamen for obvious reasons), lasts until the
Codex Morbus is destroyed.

Lastly the Blade Heretic tree has been shuffled a bit to introduce the
new spell.

Stance Of the Torn Champion has been **TEMPORARILY** Removed, it will
come back in a later PR.

Code by me and Xander

Sprites by INFRARED_BARON and OrcaCora.

Lore tibids by NecromancerAnne.

## Why It's Good For The Game

The following is an atomisation of The Heretic Knowledge Rework I'm
currently working on alongside Edge (Heretic's Grandaddy).

Given the whole PR was probably going to be impossibly big to review; I
asked Melbert If could introduce the new knowledges first, so here we
are.

Do not stress the locations of these knowledges in the tree; While they
do fill what few empty slots we still have, it doesn't change the fact
that the Heretic tree is an incomprehensible mess and will soon be
reworked.

**Warren King's Welcome:**

Not having mantainence access as an antag sucks.

Arguably it sucks even more for Heretics as they are required to find
some place discrete in order to be able to cast their rituals.

It's not unusual for the station to be so crowded, that setting up a
base in space is the only option, the external access helps with that a
little bit.

**Phylactery Of Damnation and Codex Morbus**

Explaining them in the same paragraph as they are intended to be used
together.

Curses might as well not exist in their current state.

The process of cursing a crewmember is way too machineous, annoying, and
nowhere near as affective as simply running to your victim and smacking
it with your blade.

All Curses have now been bundled to the new Codex, they no longer
require X reagents, only a drip of the victim's blood.

That's when the phylactery comes into play.

Victims still feel "a tiny prick" upon being juiced, so beware.

**Ether Of The Newborn:** The point of this knowledge is to serve as a
backup plan to "random bullshittery".


It's not really fun rolling one bad trauma or disease and have it
completely invalidate your Heretic round.

We already have potions that either heal or provide remedies against
wounds/limb loss, the Ether is supposed to be an extreme solution, hence
why it causes a 1 minute sleep upon consumption.

**Greaves Of The Prophet:** Heretic to this day is fairly lacking when
it comes to passive immunities or tools we grant to most of our core
antagonists.

Specifically, for a melee-focused antagonist, a total lack of antislip
is kinda lame, being one of the most common defense tools employed by
the crew against newbie antagonist players.

Given these cannot be concealed unlike the traitor counterpart and how
far down the tree they are, i felt like making them lube resistant was a
unique twist and sensible for what's essentialy our core progression
antagonist.

**Rust Sower Grenade:** directly inspired by the 40k Blight Grenades.

The Rust Sower nades serve a double purpose.

1) They introduce a new form of area Denial available to all heretic
paths.

2) They confer to non Rust Heretics a way to deal with the so hated
Silicon Menace.

I'm of the not-so-unpopular school of thought of "Mechs and Silicons
have had it too good for too long".

A massive chunk of our threat roster gets to this day completely shut
down by mechs.

I feel like it was about time to make everything Inorganic feel afraid
again.

To make it a bit more fair, these grenades have a fairly long detonation
timer and have been given a couple of unique SFX.


**Wolves Among Sheep**

Even after the last batch of Changes, Blade Heretic still felt a bit
uninspired to me.

The path is still essentialy just about running at people and stabbing
them in the face.

While that's part of the appreal, I'd reckon it's still lacking a bit on
the eldritch side of things.

Trapping opponents into an arena when they are forced to either engage
you or betray their friends to escape can create some potentially
interesting story-telling.

It also warps the ,oh, so beloathed stun meta we live in by forcing
participants to resort to lethal weaponry.

Ultimately, this is supposed to be a high risk/high reward spell, if you
trap 5 people arm them with heretic blades, and make them all fully stun
immune, you are likely gonna get lynched.

To free up a slot in the tree I **TEMPORARILY** Removed Stance of the
Torn champion, it will come back in my nextish pr, so don't worry about
it too much.

## Changelog

🆑
add: New Heretic starting Side-Knowdge Warren King's Welcome
add: New Heretic T1 Side knowledge, Phylactery Of Damnation.
add: New Heretic T2 Side knowledge, Ether Of The Newborn.
add: New Heretic T3 Side knowledge, Codex Morbus.
add: New Heretic T2 Side knowledge, Rust Sower grenade.
add: New Heretic T3 Side knowledge, Greaves Of The Prophet.
add: New Blade Path Spell, Wolves Among Sheep.
balance: Heretic curses have been removed from the tree and bundled in
the new Knowledge, Codex Morbus.
balance: Blade Path tree has been shuffled a bit, all spells have been
moved up by one tier to make space for the new spell.
removal: Stance Of The Torn Champion has been removed.
/🆑

---------

Co-authored-by: Xander3359 <66163761+Xander3359@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: carlarctg <53100513+carlarctg@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2025-02-17 11:15:20 +01:00
..
2024-07-09 17:39:35 +02:00
2024-09-08 01:50:00 +00:00
2024-08-14 20:55:06 +02:00
2024-06-14 17:25:05 +00:00
2024-09-10 17:04:59 +02:00

Unit Tests

What is unit testing?

Unit tests are automated code to verify that parts of the game work exactly as they should. For example, a test to make sure that the amputation surgery actually amputates the limb. These are ran every time a PR is made, and thus are very helpful for preventing bugs from cropping up in your code that would've otherwise gone unnoticed. For example, would you have thought to check that beach boys would still work the same after editing pizza? If you value your time, probably not.

On their most basic level, when UNIT_TESTS is defined, all subtypes of /datum/unit_test will have their Run proc executed. From here, if Fail is called at any point, then the tests will report as failed.

How do I write one?

  1. Find a relevant file.

All unit test related code is in code/modules/unit_tests. If you are adding a new test for a surgery, for example, then you'd open surgeries.dm. If a relevant file does not exist, simply create one in this folder, then #include it in _unit_tests.dm.

  1. Create the unit test.

To make a new unit test, you simply need to define a /datum/unit_test.

For example, let's suppose that we are creating a test to make sure a proc square correctly raises inputs to the power of two. We'd start with first:

/datum/unit_test/square/Run()

This defines our new unit test, /datum/unit_test/square. Inside this function, we're then going to run through whatever we want to check. Tests provide a few assertion functions to make this easy. For now, we're going to use TEST_ASSERT_EQUAL.

/datum/unit_test/square/Run()
    TEST_ASSERT_EQUAL(square(3), 9, "square(3) did not return 9")
    TEST_ASSERT_EQUAL(square(4), 16, "square(4) did not return 16")

As you can hopefully tell, we're simply checking if the output of square matches the output we are expecting. If the test fails, it'll report the error message given as well as whatever the actual output was.

  1. Run the unit test

Open code/_compile_options.dm and uncomment the following line.

//#define UNIT_TESTS			//If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between

There are 3 ways to run unit tests

  • Run tgstation.dmb in Dream Daemon. Don't bother trying to connect, you won't need to. You'll be able to see the outputs of all the tests. You'll get to see which tests failed and for what reason. If they all pass, you're set!

  • Launch game from VS Code. Launch the game as normal & you will see the output of your unit tests in your fancy chat window. This is preferred as you can use the debugger to step through each line of your unit test & can use the games inbuilt debugging tools to further aid in testing

  • Use VS Code Tgstation Test Explorer Extension. This allows you to run tests without launching the game & can also run focused tests(either a single or a selected group)

How to think about tests

Unit tests exist to prevent bugs that would happen in a real game. Thus, they should attempt to emulate the game world wherever possible. For example, the quick swap sanity test emulates a real scenario of the bug it fixed occurring by creating a character and giving it real items. The unrecommended alternative would be to create special test-only items. This isn't a hard rule, the reagent method exposure tests create a test-only reagent for example, but do keep it in mind.

Unit tests should also be just that--testing units of code. For example, instead of having one massive test for reagents, there are instead several smaller tests for testing exposure, metabolization, etc.

The unit testing API

You can find more information about all of these from their respective doc comments, but for a brief overview:

/datum/unit_test - The base for all tests to be ran. Subtypes must override Run(). New() and Destroy() can be used for setup and teardown. To fail, use TEST_FAIL(reason).

/datum/unit_test/proc/allocate(type, ...) - Allocates an instance of the provided type with the given arguments. Is automatically destroyed when the test is over. Commonly seen in the form of var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human/consistent).

TEST_FAIL(reason) - Marks a failure at this location, but does not stop the test.

TEST_ASSERT(assertion, reason) - Stops the unit test and fails if the assertion is not met. For example: TEST_ASSERT(powered(), "Machine is not powered").

TEST_ASSERT_NOTNULL(a, message) - Same as TEST_ASSERT, but checks if !isnull(a). For example: TEST_ASSERT_NOTNULL(myatom, "My atom was never set!").

TEST_ASSERT_NULL(a, message) - Same as TEST_ASSERT, but checks if isnull(a). If not, gives a helpful message showing what a was. For example: TEST_ASSERT_NULL(delme, "Delme was never cleaned up!").

TEST_ASSERT_EQUAL(a, b, message) - Same as TEST_ASSERT, but checks if a == b. If not, gives a helpful message showing what both a and b were. For example: TEST_ASSERT_EQUAL(2 + 2, 4, "The universe is falling apart before our eyes!").

TEST_ASSERT_NOTEQUAL(a, b, message) - Same as TEST_ASSERT_EQUAL, but reversed.

TEST_FOCUS(test_path) - Only run the test provided within the parameters. Useful for reducing noise. For example, if we only want to run our example square test, we can add TEST_FOCUS(/datum/unit_test/square). Should never be pushed in a pull request--you will be laughed at.

Final Notes

  • Writing tests before you attempt to fix the bug can actually speed up development a lot! It means you don't have to go in game and folllow the same exact steps manually every time. This process is known as "TDD" (test driven development). Write the test first, make sure it fails, then start work on the fix/feature, and you'll know you're done when your tests pass. If you do try this, do make sure to confirm in a non-testing environment just to double check.
  • Make sure that your tests don't accidentally call RNG functions like prob. Since RNG is seeded during tests, you may not realize you have until someone else makes a PR and the tests fail!
  • Do your best not to change the behavior of non-testing code during tests. While it may sometimes be necessary in the case of situations such as the above, it is still a slippery slope that can lead to the code you're testing being too different from the production environment to be useful.