Files
Bubberstation/code/datums/components/splattercasting.dm
SkyratBot 3b8752202b [MIRROR] Adds Untie Shoes, a 1-point wizard spell. (#28972)
* Adds Untie Shoes, a 1-point wizard spell. (#84880)

## About The Pull Request

Added Untie Shoes. This is a wizard spell that's seemingly weak but has
some power under the surface.

The first level unties, then knots shoes.
The second level allows you to tie jackboots and the like.
The third level allows you to summon shoes if the target has none.
And, for the true pranksters out there, the fourth level makes
invocations silent and gestureless.

Also, it always slows noncarbons down a bit.

It's also given to clowns after Jubilation, and the wizard themself, at
max level for the latter, if they dont have it already.

### Why would you ever pick this??

Knotted shoes make the wearer unable to walk without being stunned and
tripping on the floor. Let that sink in! Anyone hit twice by the spell
is forced to crawl around or risk stepping on broken glass. Worse, they
need to go through a looong process to untie their shoes to even drop
them.
This spell has infinite range, although casting from beyond screen range
or through zlevels multiplies the cooldown by ten, which is excellent
for softening up targets.
It's a 1-point, ranged, supportive spell with low cooldown, which makes
it excellent as a deterrent for harassing wizards at long range -
something they often lack answers to.
It's great for whittling down antimagic charges.
It's funny.

## Why It's Good For The Game

This spell is silly, comical, yet also very versatile and adds a rather
large amount of depth to Wizard while also expanding on shoe knotting,
which is inherently funny and rarely looked at.

I also wanted it to work through camera consoles because that's
EXTREMELY funny. The long cooldown should prevent it from being too
annoying.

## Changelog

🆑
add: Adds Untie Shoes, a 1-point wizard spell. It can be upgraded to
untie jackboots, summon shoes to untie, and become completely silent!
/🆑

* Adds Untie Shoes, a 1-point wizard spell.

---------

Co-authored-by: carlarctg <53100513+carlarctg@users.noreply.github.com>
2024-07-22 09:51:42 -04:00

102 lines
4.1 KiB
Plaintext

///how much we multiply cooldown (deciseconds) by to get the amount of blood to remove.
///BLOOD_VOLUME_NORMAL is 560, expensive spells max out at around 60 seconds which is 600 deciseconds
///removing 9/10ths of the cooldown from that puts us at 540 deciseconds, mult by 0.5 gives 270 blood taken
///one second is worth 5 blood, roughly half of your normal amount of blood taken for a huge spell, seems fair
#define COOLDOWN_TO_BLOOD_RATIO 0.5
/**
* # splattercasting component!
*
* Component that makes casted spells cost blood from the user and dramatically lowers their cooldown.
*/
/datum/component/splattercasting
/datum/component/splattercasting/Initialize()
if(!iscarbon(parent))
return COMPONENT_INCOMPATIBLE
/datum/component/splattercasting/RegisterWithParent()
. = ..()
RegisterSignal(parent, COMSIG_SPECIES_LOSS, PROC_REF(on_species_change))
RegisterSignal(parent, COMSIG_MOB_SPELL_PROJECTILE, PROC_REF(on_spell_projectile))
RegisterSignal(parent, COMSIG_MOB_BEFORE_SPELL_CAST, PROC_REF(on_before_spell_cast))
RegisterSignal(parent, COMSIG_MOB_AFTER_SPELL_CAST, PROC_REF(on_after_spell_cast))
ADD_TRAIT(parent, TRAIT_SPLATTERCASTER, REF(src))
/datum/component/splattercasting/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, list(COMSIG_SPECIES_LOSS, COMSIG_MOB_SPELL_PROJECTILE, COMSIG_MOB_BEFORE_SPELL_CAST, COMSIG_MOB_AFTER_SPELL_CAST))
REMOVE_TRAIT(parent, TRAIT_SPLATTERCASTER, REF(src))
///signal sent when a spell casts a projectile
/datum/component/splattercasting/proc/on_species_change(mob/living/carbon/source, datum/species/lost_species)
SIGNAL_HANDLER
qdel(src)
///signal sent when the parent casts a spell that has a projectile
/datum/component/splattercasting/proc/on_spell_projectile(mob/living/carbon/source, datum/action/cooldown/spell/spell, atom/cast_on, obj/projectile/to_fire)
SIGNAL_HANDLER
if(spell.school == SCHOOL_SANGUINE)
//already has blood themed projectiles
return
playsound(source, 'sound/effects/wounds/splatter.ogg', 60, TRUE, -1)
to_fire.color = "#ff7070"
to_fire.name = "blood-[to_fire.name]"
to_fire.set_light(2, 2, LIGHT_COLOR_BLOOD_MAGIC, l_on = TRUE)
///signal sent before parent casts a spell
/datum/component/splattercasting/proc/on_before_spell_cast(mob/living/carbon/source, datum/action/cooldown/spell/spell, atom/cast_on)
SIGNAL_HANDLER
var/changed_spell = FALSE
if(!(spell.spell_requirements & SPELL_REQUIRES_NO_ANTIMAGIC))
spell.spell_requirements |= SPELL_REQUIRES_NO_ANTIMAGIC
changed_spell = TRUE
if(!(spell.antimagic_flags & MAGIC_RESISTANCE_HOLY))
spell.antimagic_flags |= MAGIC_RESISTANCE_HOLY
changed_spell = TRUE
if(changed_spell)
//we changed some kind of antimagic so we should check if the new version of the spell is still valid.
//since can_cast_spell has already been checked before "before spell cast" only antimagic check should fail
if(!spell.can_cast_spell(feedback = TRUE))
return SPELL_CANCEL_CAST
///signal sent after parent casts a spell
/datum/component/splattercasting/proc/on_after_spell_cast(mob/living/carbon/source, datum/action/cooldown/spell/spell, atom/cast_on)
SIGNAL_HANDLER
if(spell.school == SCHOOL_SANGUINE)
//allows for sanguine spells that work specially with blood to not interact with splattercasting.
//might sound weird, but maybe in the future we'll have a spell that adds blood to the user when it hits a target
//we wouldn't want that to cost blood.
return
//normal cooldown spell has
var/cooldown_remaining = spell.next_use_time - world.time
//how much we discount, we make the spell cost 1/10th of its actual cooldown
var/new_cooldown = cooldown_remaining / 10
//convert how much cooldown that spell saved into blood cost
var/blood_cost = (cooldown_remaining - new_cooldown ) * COOLDOWN_TO_BLOOD_RATIO
spell.StartCooldown(new_cooldown)
source.blood_volume -= blood_cost
var/cost_desc
switch(blood_cost)
if(1 to 50)
cost_desc = "trickle"
if(51 to 100)
cost_desc = "stream"
if(101 to 200)
cost_desc = "river"
if(201 to INFINITY)
cost_desc = "torrent"
to_chat(source, span_danger("You feel a [cost_desc] of your blood drained into the spell you just cast."))
#undef COOLDOWN_TO_BLOOD_RATIO