diff --git a/code/datums/action.dm b/code/datums/action.dm
index bf1843c32d3..c6267235683 100644
--- a/code/datums/action.dm
+++ b/code/datums/action.dm
@@ -561,7 +561,7 @@
var/obj/effect/proc_holder/spell/S = target
if(!istype(S))
return ..()
- var/progress = S.get_availability_percentage()
+ var/progress = S.cooldown_handler.get_availability_percentage()
if(progress == 1)
return ..() // This means that the spell is charged but unavailable due to something else
diff --git a/code/datums/spell.dm b/code/datums/spell.dm
index a5a80996d06..e48aa12c937 100644
--- a/code/datums/spell.dm
+++ b/code/datums/spell.dm
@@ -80,12 +80,9 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
opacity = FALSE
var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?
-
- var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that
-
- var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges"
+ ///recharge time in deciseconds
+ var/base_cooldown = 10 SECONDS
var/starts_charged = TRUE //Does this spell start ready to go?
- var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges"
var/should_recharge_after_cast = TRUE
var/still_recharging_msg = "The spell is still recharging."
@@ -148,6 +145,8 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
var/datum/spell_handler/custom_handler
/// List with the handler datums per spell type. Key = src.type, value = the handler datum created by create_new_handler()
var/static/list/spell_handlers = list()
+ /// handles a given spells cooldowns. tracks the time until its off cooldown,
+ var/datum/spell_cooldown/cooldown_handler
/* Checks if the user can cast the spell
* @param charge_check If the proc should do the cooldown check
@@ -189,13 +188,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
*/
/obj/effect/proc_holder/spell/proc/spend_spell_cost(mob/user)
SHOULD_CALL_PARENT(TRUE)
- switch(charge_type)
- if("recharge")
- charge_counter = 0 //doesn't start recharging until the targets selecting ends
- if("charges")
- charge_counter-- //returns the charge if the targets selecting fails
- if("holdervar")
- adjust_var(user, holder_var_type, holder_var_amount)
custom_handler?.spend_spell_cost(user, src)
@@ -227,10 +219,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
..()
action = new(src)
still_recharging_msg = "[name] is still recharging."
- if(starts_charged)
- charge_counter = charge_max
- else
- start_recharge()
if(!gain_desc)
gain_desc = "You can now use [src]."
@@ -244,9 +232,12 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
if(spell_handlers[type] != NONE)
custom_handler = spell_handlers[type]
targeting = targeting_datums[type]
+ cooldown_handler = create_new_cooldown()
+ cooldown_handler.cooldown_init(src)
/obj/effect/proc_holder/spell/Destroy()
QDEL_NULL(action)
+ QDEL_NULL(cooldown_handler)
return ..()
/**
@@ -266,6 +257,18 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
RETURN_TYPE(/datum/spell_handler)
return NONE
+/**
+ * Creates and returns the spells cooldown handler, defaults to the standard recharge handler.
+ * Override this if you wish to use a different method of cooldown
+ */
+
+/obj/effect/proc_holder/spell/proc/create_new_cooldown()
+ RETURN_TYPE(/datum/spell_cooldown)
+ var/datum/spell_cooldown/S = new
+ S.recharge_duration = base_cooldown
+ S.starts_off_cooldown = starts_charged
+ return S
+
/obj/effect/proc_holder/spell/Click()
if(cast_check(TRUE, FALSE, usr))
choose_targets(usr)
@@ -318,20 +321,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
perform(targets, should_recharge_after_cast, user)
-/obj/effect/proc_holder/spell/proc/start_recharge()
- if(action)
- action.UpdateButtonIcon()
- START_PROCESSING(SSfastprocess, src)
-
-/obj/effect/proc_holder/spell/process()
- charge_counter += 2
- if(action)
- action.UpdateButtonIcon()
- if(charge_counter < charge_max)
- return
- STOP_PROCESSING(SSfastprocess, src)
- charge_counter = charge_max
-
/**
* Handles all the code for performing a spell once the targets are known
*
@@ -349,9 +338,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
write_custom_logs(targets, user)
if(create_attack_logs)
add_attack_logs(user, targets, "cast the spell [name]", ATKLOG_ALL)
- spawn(0)
- if(charge_type == "recharge" && recharge)
- start_recharge()
+ cooldown_handler.start_recharge()
if(sound)
playMagSound()
@@ -436,14 +423,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
return
/obj/effect/proc_holder/spell/proc/revert_cast(mob/user = usr) //resets recharge or readds a charge
- switch(charge_type)
- if("recharge")
- charge_counter = charge_max
- if("charges")
- charge_counter++
- if("holdervar")
- adjust_var(user, holder_var_type, -holder_var_amount)
-
+ cooldown_handler.revert_cast()
custom_handler?.revert_cast(user, src)
if(action)
@@ -473,22 +453,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
target.vars[type] += amount //I bear no responsibility for the runtimes that'll happen if you try to adjust non-numeric or even non-existant vars
return
-/obj/effect/proc_holder/spell/proc/get_availability_percentage()
- switch(charge_type)
- if("recharge")
- if(charge_counter == 0)
- return 0
- if(charge_max == 0)
- return 1
- return charge_counter / charge_max
- if("charges")
- if(charge_counter)
- return 1
- return 0
- if("holdervar")
- return 1
-
-
/obj/effect/proc_holder/spell/aoe_turf
create_attack_logs = FALSE
create_custom_logs = TRUE
@@ -513,17 +477,11 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
return FALSE
if(charge_check)
- switch(charge_type)
- if("recharge")
- if(charge_counter < charge_max)
- if(show_message)
- to_chat(user, still_recharging_msg)
- return FALSE
- if("charges")
- if(!charge_counter)
- if(show_message)
- to_chat(user, "[name] has no charges left.")
- return FALSE
+ if(cooldown_handler.is_on_cooldown())
+ if(show_message)
+ to_chat(user, still_recharging_msg)
+ return FALSE
+
if(!ghost)
if(user.stat && !stat_allowed)
if(show_message)
@@ -567,7 +525,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
/obj/effect/proc_holder/spell/summonmob
name = "Summon Servant"
desc = "This spell can be used to call your servant, whenever you need it."
- charge_max = 100
+ base_cooldown = 10 SECONDS
clothes_req = FALSE
invocation = "JE VES"
invocation_type = "whisper"
diff --git a/code/datums/spell_cooldown/spell_charges.dm b/code/datums/spell_cooldown/spell_charges.dm
new file mode 100644
index 00000000000..0082720bd41
--- /dev/null
+++ b/code/datums/spell_cooldown/spell_charges.dm
@@ -0,0 +1,37 @@
+/datum/spell_cooldown/charges
+ /// the max number of charges a spell can have
+ var/max_charges = 2
+ /// the number of charges we currently have
+ var/current_charges = 0
+ /// the cooldown between uses of charges
+ var/charge_duration = 1 SECONDS
+ /// the time at which a spell charge can be used
+ var/charge_time
+
+/datum/spell_cooldown/charges/cooldown_init(obj/effect/proc_holder/spell/new_spell)
+ . = ..()
+ if(starts_off_cooldown)
+ current_charges = max_charges
+
+/datum/spell_cooldown/charges/is_on_cooldown()
+ return !current_charges || charge_time >= world.time
+
+/datum/spell_cooldown/charges/should_end_cooldown()
+ if(recharge_time > world.time)
+ return FALSE
+ current_charges++
+ if(current_charges < max_charges) // we have more recharges to go
+ recharge_time = world.time + recharge_duration
+ return FALSE
+ return TRUE
+
+/datum/spell_cooldown/charges/start_recharge(recharge_override = 0)
+ current_charges--
+ if(current_charges)
+ charge_time = world.time + charge_duration
+ ..()
+
+
+/datum/spell_cooldown/charges/revert_cast()
+ ..()
+ charge_time = world.time
diff --git a/code/datums/spell_cooldown/spell_cooldown.dm b/code/datums/spell_cooldown/spell_cooldown.dm
new file mode 100644
index 00000000000..f341658b7e6
--- /dev/null
+++ b/code/datums/spell_cooldown/spell_cooldown.dm
@@ -0,0 +1,59 @@
+/datum/spell_cooldown
+ /// the world.time the spell will be available again
+ var/recharge_time = 0
+ /// the amount of time that must pass before a spell can be used again
+ var/recharge_duration = 10 SECONDS // default spell cooldown
+ /// does it start off cooldown?
+ var/starts_off_cooldown = TRUE
+ /// holds a ref to the spell
+ var/obj/effect/proc_holder/spell/spell_parent
+
+/datum/spell_cooldown/Destroy()
+ spell_parent = null
+ return ..()
+
+/datum/spell_cooldown/proc/cooldown_init(obj/effect/proc_holder/spell/new_spell)
+ spell_parent = new_spell
+ if(!starts_off_cooldown)
+ start_recharge()
+
+/datum/spell_cooldown/proc/is_on_cooldown()
+ return recharge_time > world.time
+
+/datum/spell_cooldown/proc/should_end_cooldown()
+ return !is_on_cooldown()
+
+/datum/spell_cooldown/proc/end_recharge()
+ return
+
+/datum/spell_cooldown/process()
+ if(!spell_parent.action)
+ stack_trace("[spell_parent.type] ended up with a null action")
+ return PROCESS_KILL
+ spell_parent.action.UpdateButtonIcon()
+ if(should_end_cooldown())
+ end_recharge()
+ return PROCESS_KILL
+
+
+/*
+ * used to track how long is left on the spell cooldown
+ * finds them time left, before we can cast (recharge_time - world.time)
+ * then subtracts that from the total time.
+ * then divides it by the total time.
+*/
+/datum/spell_cooldown/proc/get_availability_percentage()
+ if(!is_on_cooldown()) // if off cooldown, we don't bother with the maths
+ return 1
+ return (recharge_duration - (recharge_time - world.time)) / recharge_duration
+
+/datum/spell_cooldown/proc/start_recharge(recharge_duration_override = 0)
+ var/recharge_increment = recharge_duration_override || recharge_duration
+ recharge_time = world.time + recharge_increment
+ if(spell_parent.action)
+ spell_parent.action.UpdateButtonIcon()
+ START_PROCESSING(SSfastprocess, src)
+
+/datum/spell_cooldown/proc/revert_cast()
+ recharge_time = world.time
+
diff --git a/code/datums/spells/banana_touch.dm b/code/datums/spells/banana_touch.dm
index e9ece6178a4..79b9e86d054 100644
--- a/code/datums/spells/banana_touch.dm
+++ b/code/datums/spells/banana_touch.dm
@@ -6,7 +6,7 @@
hand_path = /obj/item/melee/touch_attack/banana
school = "transmutation"
- charge_max = 300
+ base_cooldown = 30 SECONDS
clothes_req = TRUE
cooldown_min = 100 //50 deciseconds reduction per rank
action_icon_state = "clown"
diff --git a/code/datums/spells/bloodcrawl.dm b/code/datums/spells/bloodcrawl.dm
index 9153d34b04d..d8299e43ac2 100644
--- a/code/datums/spells/bloodcrawl.dm
+++ b/code/datums/spells/bloodcrawl.dm
@@ -1,7 +1,7 @@
/obj/effect/proc_holder/spell/bloodcrawl
name = "Blood Crawl"
desc = "Use pools of blood to phase out of existence."
- charge_max = 0
+ base_cooldown = 0
clothes_req = FALSE
cooldown_min = 0
should_recharge_after_cast = FALSE
@@ -38,4 +38,4 @@
else
if(user.phaseout(target))
phased = TRUE
- start_recharge()
+ cooldown_handler.start_recharge()
diff --git a/code/datums/spells/chaplain.dm b/code/datums/spells/chaplain.dm
index 5454e51ce42..35ab9fcedab 100644
--- a/code/datums/spells/chaplain.dm
+++ b/code/datums/spells/chaplain.dm
@@ -4,7 +4,7 @@
desc = "Blesses a single person."
school = "transmutation"
- charge_max = 60
+ base_cooldown = 6 SECONDS
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
diff --git a/code/datums/spells/charge.dm b/code/datums/spells/charge.dm
index 9fb4c58a9e9..6a5aa0a13c7 100644
--- a/code/datums/spells/charge.dm
+++ b/code/datums/spells/charge.dm
@@ -2,7 +2,7 @@
name = "Charge"
desc = "This spell can be used to recharge a variety of things in your hands, from magical artifacts to electrical components. A creative wizard can even use it to grant magical power to a fellow magic user."
school = "transmutation"
- charge_max = 600
+ base_cooldown = 1 MINUTES
clothes_req = FALSE
invocation = "DIRI CEL"
invocation_type = "whisper"
@@ -22,10 +22,10 @@
var/mob/living/M = L.pulling
if(M.mob_spell_list.len != 0 || (M.mind && M.mind.spell_list.len != 0))
for(var/obj/effect/proc_holder/spell/S in M.mob_spell_list)
- S.charge_counter = S.charge_max
+ S.cooldown_handler.revert_cast()
if(M.mind)
for(var/obj/effect/proc_holder/spell/S in M.mind.spell_list)
- S.charge_counter = S.charge_max
+ S.cooldown_handler.revert_cast()
to_chat(M, "You feel raw magical energy flowing through you, it feels good!")
else
to_chat(M, "You feel very strange for a moment, but then it passes.")
diff --git a/code/datums/spells/charge_up.dm b/code/datums/spells/charge_up.dm
index 24eba2c7d1a..b1ca3e28d2b 100644
--- a/code/datums/spells/charge_up.dm
+++ b/code/datums/spells/charge_up.dm
@@ -36,10 +36,9 @@
/obj/effect/proc_holder/spell/charge_up/proc/try_stop_buildup(mob/user)
var/energy_perc = get_energy_charge() / max_charge_time
if(energy_perc < 0.5)
- charge_counter = (1 - energy_perc) * charge_max // Give them some charge back
+ cooldown_handler.start_recharge((1 - energy_perc) * cooldown_handler.recharge_duration) // Shorten the cooldown based on how long it was charged for.
to_chat(user, "[stop_charging_text]")
Reset(user)
- start_recharge()
return TRUE
else
to_chat(user, "[stop_charging_fail_text]")
@@ -74,7 +73,7 @@
to_chat(user, "You lose control over the spell!")
Reset(user)
spend_spell_cost(user)
- start_recharge()
+ cooldown_handler.start_recharge()
/obj/effect/proc_holder/spell/charge_up/after_cast(list/targets, mob/user)
..()
diff --git a/code/datums/spells/cluwne.dm b/code/datums/spells/cluwne.dm
index 11f043b2685..be8aaf7892a 100644
--- a/code/datums/spells/cluwne.dm
+++ b/code/datums/spells/cluwne.dm
@@ -5,7 +5,7 @@
school = "transmutation"
- charge_max = 600
+ base_cooldown = 1 MINUTES
clothes_req = TRUE
cooldown_min = 200 //100 deciseconds reduction per rank
diff --git a/code/datums/spells/conjure.dm b/code/datums/spells/conjure.dm
index 17a5b53d0a1..7e6a5684b24 100644
--- a/code/datums/spells/conjure.dm
+++ b/code/datums/spells/conjure.dm
@@ -45,11 +45,7 @@
if(summon_lifespan)
QDEL_IN(summoned_object, summon_lifespan)
else
- switch(charge_type)
- if("recharge")
- charge_counter = charge_max - 5//So you don't lose charge for a failed spell(Also prevents most over-fill)
- if("charges")
- charge_counter++//Ditto, just for different spell types
+ cooldown_handler.start_recharge(0.5 SECONDS)
return
diff --git a/code/datums/spells/conjure_item.dm b/code/datums/spells/conjure_item.dm
index ec11796eeef..d2e77429b87 100644
--- a/code/datums/spells/conjure_item.dm
+++ b/code/datums/spells/conjure_item.dm
@@ -6,7 +6,7 @@
var/obj/item/item
var/item_type = /obj/item/banhammer
school = "conjuration"
- charge_max = 150
+ base_cooldown = 15 SECONDS
cooldown_min = 10
/obj/effect/proc_holder/spell/conjure_item/create_new_targeting()
diff --git a/code/datums/spells/construct_spells.dm b/code/datums/spells/construct_spells.dm
index b62cd3220a9..0c4707faf53 100644
--- a/code/datums/spells/construct_spells.dm
+++ b/code/datums/spells/construct_spells.dm
@@ -1,7 +1,7 @@
//////////////////////////////Construct Spells/////////////////////////
/obj/effect/proc_holder/spell/aoe_turf/conjure/construct/lesser
- charge_max = 1800
+ base_cooldown = 1800
action_icon_state = "artificer"
action_background_icon_state = "bg_cult"
@@ -17,7 +17,7 @@
action_icon_state = "floorconstruct"
action_background_icon_state = "bg_cult"
school = "conjuration"
- charge_max = 20
+ base_cooldown = 20
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -31,7 +31,7 @@
action_icon_state = "cultforcewall"
action_background_icon_state = "bg_cult"
school = "conjuration"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -43,7 +43,7 @@
name = "Greater Construction"
desc = "This spell constructs a reinforced metal wall"
school = "conjuration"
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -59,7 +59,7 @@
action_icon_state = "summonsoulstone"
action_background_icon_state = "bg_cult"
school = "conjuration"
- charge_max = 3000
+ base_cooldown = 3000
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -78,7 +78,7 @@
action_icon_state = "pylon"
action_background_icon_state = "bg_cult"
school = "conjuration"
- charge_max = 200
+ base_cooldown = 200
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -93,7 +93,7 @@
action_icon_state = "cultforcewall"
action_background_icon_state = "bg_cult"
school = "transmutation"
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -113,7 +113,7 @@
desc = "This spell allows you to pass through walls"
action_icon_state = "phaseshift"
action_background_icon_state = "bg_cult"
- charge_max = 200
+ base_cooldown = 200
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -140,7 +140,7 @@
desc = "This spell fires several, slow moving, magic projectiles at nearby targets."
action_background_icon_state = "bg_cult"
school = "evocation"
- charge_max = 400
+ base_cooldown = 400
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -165,7 +165,7 @@
action_icon_state = "parasmoke"
action_background_icon_state = "bg_cult"
school = "conjuration"
- charge_max = 200
+ base_cooldown = 200
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
diff --git a/code/datums/spells/ethereal_jaunt.dm b/code/datums/spells/ethereal_jaunt.dm
index 1cb5c341e34..4646974b3fd 100644
--- a/code/datums/spells/ethereal_jaunt.dm
+++ b/code/datums/spells/ethereal_jaunt.dm
@@ -3,7 +3,7 @@
desc = "This spell creates your ethereal form, temporarily making you invisible and able to pass through walls."
school = "transmutation"
- charge_max = 300
+ base_cooldown = 300
clothes_req = TRUE
invocation = "none"
invocation_type = "none"
diff --git a/code/datums/spells/fake_gib.dm b/code/datums/spells/fake_gib.dm
index 195987bb335..138db2c0c2a 100644
--- a/code/datums/spells/fake_gib.dm
+++ b/code/datums/spells/fake_gib.dm
@@ -4,7 +4,7 @@
hand_path = "/obj/item/melee/touch_attack/fake_disintegrate"
school = "evocation"
- charge_max = 600
+ base_cooldown = 600
clothes_req = FALSE
cooldown_min = 200 //100 deciseconds reduction per rank
diff --git a/code/datums/spells/genetic.dm b/code/datums/spells/genetic.dm
index 4a03f2c5a6c..f6c45378f9d 100644
--- a/code/datums/spells/genetic.dm
+++ b/code/datums/spells/genetic.dm
@@ -17,7 +17,7 @@
ADD_TRAIT(target, A, MAGIC_TRAIT)
active_on += target
target.regenerate_icons()
- if(duration < charge_max)
+ if(duration < base_cooldown)
addtimer(CALLBACK(src, .proc/remove, target), duration, TIMER_OVERRIDE|TIMER_UNIQUE)
/obj/effect/proc_holder/spell/genetic/Destroy()
diff --git a/code/datums/spells/horsemask.dm b/code/datums/spells/horsemask.dm
index ae9696f40c1..a3906fc32bc 100644
--- a/code/datums/spells/horsemask.dm
+++ b/code/datums/spells/horsemask.dm
@@ -2,9 +2,7 @@
name = "Curse of the Horseman"
desc = "This spell triggers a curse on a target, causing them to wield an unremovable horse head mask. They will speak like a horse! Any masks they are wearing will be disintegrated. This spell does not require robes."
school = "transmutation"
- charge_type = "recharge"
- charge_max = 150
- charge_counter = 0
+ base_cooldown = 150
clothes_req = FALSE
stat_allowed = CONSCIOUS
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
diff --git a/code/datums/spells/infinite_guns.dm b/code/datums/spells/infinite_guns.dm
index 8cf011a7f55..3573bf70f99 100644
--- a/code/datums/spells/infinite_guns.dm
+++ b/code/datums/spells/infinite_guns.dm
@@ -4,7 +4,7 @@
invocation_type = "none"
school = "conjuration"
- charge_max = 600
+ base_cooldown = 600
clothes_req = TRUE
cooldown_min = 10 //Gun wizard
action_icon_state = "bolt_action"
diff --git a/code/datums/spells/knock.dm b/code/datums/spells/knock.dm
index 6cd35f68e12..bde611f909d 100644
--- a/code/datums/spells/knock.dm
+++ b/code/datums/spells/knock.dm
@@ -3,7 +3,7 @@
desc = "This spell opens nearby doors and does not require wizard garb."
school = "transmutation"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
invocation = "AULIE OXIN FIERA"
invocation_type = "whisper"
@@ -42,7 +42,7 @@
name = "Greater Knock"
desc = "On first cast, will remove access restrictions on all airlocks on the station, and announce this spell's use to the station. On any further cast, will open all doors in sight. Cannot be refunded once bought!"
- charge_max = 200
+ base_cooldown = 200
invocation = "MAIOR OXIN FIERA"
invocation_type = "shout"
level_max = 0 //Cannot be improved, quality of life since can't be refunded
diff --git a/code/datums/spells/lichdom.dm b/code/datums/spells/lichdom.dm
index d607033a4f4..fb867cb905d 100644
--- a/code/datums/spells/lichdom.dm
+++ b/code/datums/spells/lichdom.dm
@@ -2,7 +2,7 @@
name = "Bind Soul"
desc = "A dark necromantic pact that can forever bind your soul to an item of your choosing. So long as both your body and the item remain intact and on the same plane you can revive from death, though the time between reincarnations grows steadily with use."
school = "necromancy"
- charge_max = 10
+ base_cooldown = 10
clothes_req = FALSE
centcom_cancast = FALSE
invocation = "NECREM IMORTIUM!"
@@ -47,7 +47,7 @@
if(M.stat == CONSCIOUS && iscarbon(M))
to_chat(M, "You aren't dead enough to revive!")//Usually a good problem to have
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
return
if(!marked_item || QDELETED(marked_item)) //Wait nevermind
@@ -71,7 +71,7 @@
M.mind.transfer_to(lich)
lich.set_species(/datum/species/skeleton)
to_chat(lich, "Your bones clatter and shutter as they're pulled back into this world!")
- charge_max += 600
+ cooldown_handler.recharge_duration += 1 MINUTES
var/mob/old_body = current_body
var/turf/body_turf = get_turf(old_body)
current_body = lich
@@ -111,8 +111,8 @@
return
name = "RISE!"
desc = "Rise from the dead! You will reform at the location of your phylactery and your old body will crumble away."
- charge_max = 1800 //3 minute cooldown, if you rise in sight of someone and killed again, you're probably screwed.
- charge_counter = 1800
+ cooldown_handler.recharge_duration = 3 MINUTES
+ cooldown_handler.revert_cast()
stat_allowed = UNCONSCIOUS
marked_item.name = "Ensouled [marked_item.name]"
marked_item.desc = "A terrible aura surrounds this item, its very existence is offensive to life itself..."
diff --git a/code/datums/spells/lightning.dm b/code/datums/spells/lightning.dm
index a2ddf98ef4f..a430de667f9 100644
--- a/code/datums/spells/lightning.dm
+++ b/code/datums/spells/lightning.dm
@@ -1,8 +1,7 @@
/obj/effect/proc_holder/spell/charge_up/bounce/lightning
name = "Lightning Bolt"
desc = "Throws a lightning bolt at your enemies. Classic. When clicked will start to charge in power. Then click on a mob to send the bolt before it overloads with power."
- charge_type = "recharge"
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
clothes_req = TRUE
invocation = "UN'LTD P'WAH!"
invocation_type = "shout"
diff --git a/code/datums/spells/magnet.dm b/code/datums/spells/magnet.dm
index ea296eb5979..68183338868 100644
--- a/code/datums/spells/magnet.dm
+++ b/code/datums/spells/magnet.dm
@@ -1,9 +1,8 @@
/obj/effect/proc_holder/spell/charge_up/bounce/magnet
name = "Magnetic Pull"
desc = "Pulls metalic objects from enemies hands with the power of MAGNETS."
- charge_type = "recharge"
action_icon_state = "magnet"
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
clothes_req = FALSE
invocation = "UN'LTD P'WAH!"
invocation_type = "none"
diff --git a/code/datums/spells/mime.dm b/code/datums/spells/mime.dm
index 541f2df42a8..3f33fdb85e4 100644
--- a/code/datums/spells/mime.dm
+++ b/code/datums/spells/mime.dm
@@ -7,7 +7,7 @@
invocation_type = "emote"
invocation_emote_self = "You form a wall in front of yourself."
summon_lifespan = 300
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
cast_sound = null
human_req = TRUE
@@ -34,7 +34,7 @@
school = "mime"
panel = "Mime"
clothes_req = FALSE
- charge_max = 3000
+ base_cooldown = 3000
human_req = TRUE
action_icon_state = "mime_silence"
@@ -70,7 +70,7 @@
wall_type = /obj/effect/forcefield/mime/advanced
invocation_type = "emote"
invocation_emote_self = "You form a blockade in front of yourself."
- charge_max = 600
+ base_cooldown = 600
sound = null
clothes_req = FALSE
@@ -94,7 +94,7 @@
school = "mime"
panel = "Mime"
clothes_req = FALSE
- charge_max = 300
+ base_cooldown = 300
human_req = TRUE
action_icon_state = "fingergun"
diff --git a/code/datums/spells/mime_malaise.dm b/code/datums/spells/mime_malaise.dm
index d152167bea8..515ee3ce235 100644
--- a/code/datums/spells/mime_malaise.dm
+++ b/code/datums/spells/mime_malaise.dm
@@ -6,7 +6,7 @@
hand_path = /obj/item/melee/touch_attack/mime_malaise
school = "transmutation"
- charge_max = 300
+ base_cooldown = 300
clothes_req = TRUE
cooldown_min = 100 //50 deciseconds reduction per rank
action_icon_state = "mime"
diff --git a/code/datums/spells/mimic.dm b/code/datums/spells/mimic.dm
index adac49bdbcf..d81a9b7e55e 100644
--- a/code/datums/spells/mimic.dm
+++ b/code/datums/spells/mimic.dm
@@ -2,7 +2,7 @@
name = "Mimic"
desc = "Learn a new form to mimic or become one of your known forms"
clothes_req = FALSE
- charge_max = 3 SECONDS
+ base_cooldown = 3 SECONDS
action_icon_state = "genetic_morph"
selection_activated_message = "Click on a target to remember it's form. Click on yourself to change form."
create_attack_logs = FALSE
diff --git a/code/datums/spells/mind_transfer.dm b/code/datums/spells/mind_transfer.dm
index a7048c067ee..0ca61e9874e 100644
--- a/code/datums/spells/mind_transfer.dm
+++ b/code/datums/spells/mind_transfer.dm
@@ -3,7 +3,7 @@
desc = "This spell allows the user to switch bodies with a target."
school = "transmutation"
- charge_max = 600
+ base_cooldown = 600
clothes_req = FALSE
invocation = "GIN'YU CAPAN"
invocation_type = "whisper"
diff --git a/code/datums/spells/night_vision.dm b/code/datums/spells/night_vision.dm
index 1799846823a..485528cb8cc 100644
--- a/code/datums/spells/night_vision.dm
+++ b/code/datums/spells/night_vision.dm
@@ -2,7 +2,7 @@
name = "Toggle Nightvision"
desc = "Toggle your nightvision mode."
- charge_max = 10
+ base_cooldown = 10
clothes_req = FALSE
message = "You toggle your night vision!"
diff --git a/code/datums/spells/rathens.dm b/code/datums/spells/rathens.dm
index f73435f1ede..1d5f2c617cb 100644
--- a/code/datums/spells/rathens.dm
+++ b/code/datums/spells/rathens.dm
@@ -1,7 +1,7 @@
/obj/effect/proc_holder/spell/rathens
name = "Rathen's Secret"
desc = "Summons a powerful shockwave around you that tears the appendix and limbs off of enemies."
- charge_max = 500
+ base_cooldown = 500
clothes_req = TRUE
invocation = "APPEN NATH!"
invocation_type = "shout"
diff --git a/code/datums/spells/rod_form.dm b/code/datums/spells/rod_form.dm
index 05c78b0b86c..48c863f19e0 100644
--- a/code/datums/spells/rod_form.dm
+++ b/code/datums/spells/rod_form.dm
@@ -3,7 +3,7 @@
desc = "Take on the form of an immovable rod, destroying all in your path."
clothes_req = TRUE
human_req = FALSE
- charge_max = 600
+ base_cooldown = 600
cooldown_min = 200
invocation = "CLANG!"
invocation_type = "shout"
diff --git a/code/datums/spells/shapeshift.dm b/code/datums/spells/shapeshift.dm
index 71248052be2..97daf8a6bbe 100644
--- a/code/datums/spells/shapeshift.dm
+++ b/code/datums/spells/shapeshift.dm
@@ -3,7 +3,7 @@
desc = "Take on the shape of another for a time to use their natural abilities. Once you've made your choice it cannot be changed."
clothes_req = FALSE
human_req = FALSE
- charge_max = 200
+ base_cooldown = 200
cooldown_min = 50
invocation = "RAC'WA NO!"
invocation_type = "shout"
diff --git a/code/datums/spells/summonitem.dm b/code/datums/spells/summonitem.dm
index 407fb6c3a5f..60c97410043 100644
--- a/code/datums/spells/summonitem.dm
+++ b/code/datums/spells/summonitem.dm
@@ -2,7 +2,7 @@
name = "Instant Summons"
desc = "This spell can be used to recall a previously marked item to your hand from anywhere in the universe."
school = "transmutation"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
invocation = "GAR YOK"
invocation_type = "whisper"
diff --git a/code/datums/spells/touch_attacks.dm b/code/datums/spells/touch_attacks.dm
index a71243a4e4d..d405e921f2b 100644
--- a/code/datums/spells/touch_attacks.dm
+++ b/code/datums/spells/touch_attacks.dm
@@ -9,7 +9,7 @@
/obj/effect/proc_holder/spell/touch/Click(mob/user = usr)
if(attached_hand)
qdel(attached_hand)
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
attached_hand = null
to_chat(user, "You draw the power out of your hand.")
return 0
@@ -21,7 +21,7 @@
if(!ChargeHand(target))
return 0
while(attached_hand) //hibernate untill the spell is actually used
- charge_counter = 0
+ cooldown_handler.recharge_time++ // adds a tick onto the cooldown each tick
sleep(1)
/obj/effect/proc_holder/spell/touch/proc/ChargeHand(mob/living/carbon/user)
@@ -37,7 +37,7 @@
hand_handled = 0
if(!hand_handled)
qdel(attached_hand)
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
attached_hand = null
to_chat(user, "Your hands are full!")
return 0
@@ -51,7 +51,7 @@
hand_path = /obj/item/melee/touch_attack/disintegrate
school = "evocation"
- charge_max = 600
+ base_cooldown = 600
clothes_req = TRUE
cooldown_min = 200 //100 deciseconds reduction per rank
@@ -63,7 +63,7 @@
hand_path = /obj/item/melee/touch_attack/fleshtostone
school = "transmutation"
- charge_max = 600
+ base_cooldown = 600
clothes_req = TRUE
cooldown_min = 200 //100 deciseconds reduction per rank
diff --git a/code/datums/spells/wizard.dm b/code/datums/spells/wizard.dm
index 6454ae3ab01..2c62d4b2725 100644
--- a/code/datums/spells/wizard.dm
+++ b/code/datums/spells/wizard.dm
@@ -3,7 +3,7 @@
desc = "This spell fires several, slow moving, magic projectiles at nearby targets."
school = "evocation"
- charge_max = 200
+ base_cooldown = 200
clothes_req = TRUE
invocation = "FORTI GY AMA"
invocation_type = "shout"
@@ -41,7 +41,7 @@
desc = "This spell fires several, slow moving, magic bikehorns at nearby targets."
school = "evocation"
- charge_max = 60
+ base_cooldown = 60
clothes_req = FALSE
invocation = "HONK GY AMA"
invocation_type = "shout"
@@ -88,7 +88,7 @@
desc = "This spell causes you to turn into a hulk and gain laser vision for a short while."
school = "transmutation"
- charge_max = 400
+ base_cooldown = 400
clothes_req = TRUE
invocation = "BIRUZ BENNAR"
invocation_type = "shout"
@@ -114,7 +114,7 @@
desc = "This spell spawns a cloud of choking smoke at your location and does not require wizard garb."
school = "conjuration"
- charge_max = 120
+ base_cooldown = 120
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -131,7 +131,7 @@
/obj/effect/proc_holder/spell/emplosion/disable_tech
name = "Disable Tech"
desc = "This spell disables all weapons, cameras and most other technology in range."
- charge_max = 400
+ base_cooldown = 400
clothes_req = TRUE
invocation = "NEC CANTIO"
invocation_type = "shout"
@@ -147,7 +147,7 @@
desc = "This spell randomly teleports you a short distance."
school = "abjuration"
- charge_max = 20
+ base_cooldown = 20
clothes_req = TRUE
invocation = "none"
invocation_type = "none"
@@ -175,7 +175,7 @@
desc = "This spell teleports you to a type of area of your selection."
school = "abjuration"
- charge_max = 600
+ base_cooldown = 600
clothes_req = TRUE
invocation = "SCYAR NILA"
invocation_type = "shout"
@@ -197,7 +197,7 @@
desc = "This spell creates a small unbreakable wall that only you can pass through, and does not need wizard garb. Lasts 30 seconds."
school = "transmutation"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
invocation = "TARCOL MINTI ZHERI"
invocation_type = "whisper"
@@ -232,7 +232,7 @@
/obj/effect/proc_holder/spell/aoe_turf/conjure/timestop
name = "Stop Time"
desc = "This spell stops time for everyone except for you, allowing you to move freely while your enemies and even projectiles are frozen."
- charge_max = 500
+ base_cooldown = 500
clothes_req = TRUE
invocation = "TOKI WO TOMARE"
invocation_type = "shout"
@@ -252,7 +252,7 @@
desc = "This spell conjures a simple carp."
school = "conjuration"
- charge_max = 1200
+ base_cooldown = 1200
clothes_req = TRUE
invocation = "NOUK FHUNMM SACP RISSKA"
invocation_type = "shout"
@@ -271,7 +271,7 @@
desc = "This spell conjures a construct which may be controlled by Shades"
school = "conjuration"
- charge_max = 600
+ base_cooldown = 600
clothes_req = FALSE
invocation = "none"
invocation_type = "none"
@@ -291,7 +291,7 @@
desc = "This spell tears the fabric of reality, allowing horrific daemons to spill forth"
school = "conjuration"
- charge_max = 1200
+ base_cooldown = 1200
clothes_req = FALSE
invocation = "IA IA"
invocation_type = "shout"
@@ -310,7 +310,7 @@
desc = "This spell temporarily blinds a single person and does not require wizard garb."
school = "transmutation"
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
invocation = "STI KALY"
invocation_type = "whisper"
@@ -344,7 +344,7 @@
desc = "This spell fires a fireball at a target and does not require wizard garb."
school = "evocation"
- charge_max = 60
+ base_cooldown = 60
clothes_req = FALSE
invocation = "ONI SOMA"
invocation_type = "shout"
@@ -388,7 +388,7 @@
/obj/effect/proc_holder/spell/aoe_turf/repulse
name = "Repulse"
desc = "This spell throws everything around the user away."
- charge_max = 400
+ base_cooldown = 400
clothes_req = TRUE
invocation = "GITTAH WEIGH"
invocation_type = "shout"
@@ -437,7 +437,7 @@
/obj/effect/proc_holder/spell/sacred_flame
name = "Sacred Flame"
desc = "Makes everyone around you more flammable, and lights yourself on fire."
- charge_max = 60
+ base_cooldown = 60
clothes_req = FALSE
invocation = "FI'RAN DADISKO"
invocation_type = "shout"
diff --git a/code/game/dna/mutations/disabilities.dm b/code/game/dna/mutations/disabilities.dm
index 57f5e667e05..8eb704bd590 100644
--- a/code/game/dna/mutations/disabilities.dm
+++ b/code/game/dna/mutations/disabilities.dm
@@ -491,8 +491,7 @@
desc = "The subject becomes able to convert excess cellular energy into thermal energy."
panel = "Abilities"
- charge_type = "recharge"
- charge_max = 600
+ base_cooldown = 600
clothes_req = FALSE
stat_allowed = CONSCIOUS
diff --git a/code/game/dna/mutations/powers.dm b/code/game/dna/mutations/powers.dm
index daf3636557f..fe5e2097a31 100644
--- a/code/game/dna/mutations/powers.dm
+++ b/code/game/dna/mutations/powers.dm
@@ -303,8 +303,7 @@
desc = "Drops the bodytemperature of another person."
panel = "Abilities"
- charge_type = "recharge"
- charge_max = 1200
+ base_cooldown = 1200
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -375,8 +374,7 @@
desc = "Eat just about anything!"
panel = "Abilities"
- charge_type = "recharge"
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -481,8 +479,7 @@
desc = "Leap great distances!"
panel = "Abilities"
- charge_type = "recharge"
- charge_max = 60
+ base_cooldown = 60
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -574,7 +571,7 @@
name = "Polymorph"
desc = "Mimic the appearance of others!"
panel = "Abilities"
- charge_max = 1800
+ base_cooldown = 1800
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -626,7 +623,7 @@
/obj/effect/proc_holder/spell/empath
name = "Read Mind"
desc = "Read the minds of others for information."
- charge_max = 180
+ base_cooldown = 180
clothes_req = FALSE
human_req = TRUE
stat_allowed = CONSCIOUS
@@ -736,7 +733,7 @@
name = "Morph"
desc = "Mimic the appearance of your choice!"
panel = "Abilities"
- charge_max = 1800
+ base_cooldown = 1800
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -921,7 +918,7 @@
/obj/effect/proc_holder/spell/remotetalk
name = "Project Mind"
desc = "Make people understand your thoughts!"
- charge_max = 0
+ base_cooldown = 0
clothes_req = FALSE
stat_allowed = CONSCIOUS
@@ -954,7 +951,7 @@
/obj/effect/proc_holder/spell/mindscan
name = "Scan Mind"
desc = "Offer people a chance to share their thoughts!"
- charge_max = 0
+ base_cooldown = 0
clothes_req = FALSE
stat_allowed = CONSCIOUS
invocation_type = "none"
@@ -1028,7 +1025,7 @@
/obj/effect/proc_holder/spell/remoteview
name = "Remote View"
desc = "Spy on people from any range!"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
stat_allowed = CONSCIOUS
diff --git a/code/game/gamemodes/miniantags/morph/spells/ambush.dm b/code/game/gamemodes/miniantags/morph/spells/ambush.dm
index d59e78ece11..1cd22128303 100644
--- a/code/game/gamemodes/miniantags/morph/spells/ambush.dm
+++ b/code/game/gamemodes/miniantags/morph/spells/ambush.dm
@@ -5,7 +5,7 @@
desc = "Prepare an ambush. Dealing significantly more damage on the first hit and you will weaken the target. Only works while morphed. If the target tries to use you with their hands then you will do even more damage. \
Keeping still for another 15 seconds will perfect your disguise."
action_icon_state = "morph_ambush"
- charge_max = 8 SECONDS
+ base_cooldown = 8 SECONDS
/obj/effect/proc_holder/spell/morph_spell/ambush/create_new_targeting()
return new /datum/spell_targeting/self
diff --git a/code/game/gamemodes/miniantags/morph/spells/open_vent.dm b/code/game/gamemodes/miniantags/morph/spells/open_vent.dm
index bd44b567033..eb05c75eeb2 100644
--- a/code/game/gamemodes/miniantags/morph/spells/open_vent.dm
+++ b/code/game/gamemodes/miniantags/morph/spells/open_vent.dm
@@ -2,7 +2,7 @@
name = "Open Vents"
desc = "Spit out acidic puke on nearby vents or scrubbers. Will take a little while for the acid to take effect. Not usable from inside a vent."
action_icon_state = "acid_vent"
- charge_max = 10 SECONDS
+ base_cooldown = 10 SECONDS
hunger_cost = 10
/obj/effect/proc_holder/spell/morph_spell/open_vent/create_new_targeting()
diff --git a/code/game/gamemodes/miniantags/morph/spells/pass_airlock.dm b/code/game/gamemodes/miniantags/morph/spells/pass_airlock.dm
index a33855e1033..849b3fd7fb7 100644
--- a/code/game/gamemodes/miniantags/morph/spells/pass_airlock.dm
+++ b/code/game/gamemodes/miniantags/morph/spells/pass_airlock.dm
@@ -5,7 +5,7 @@
action_background_icon_state = "bg_morph"
action_icon_state = "morph_airlock"
clothes_req = FALSE
- charge_max = 10 SECONDS
+ base_cooldown = 10 SECONDS
selection_activated_message = "Click on an airlock to try pass it."
/obj/effect/proc_holder/spell/morph_spell/pass_airlock/create_new_targeting()
diff --git a/code/game/gamemodes/miniantags/morph/spells/reproduce.dm b/code/game/gamemodes/miniantags/morph/spells/reproduce.dm
index 517aa178381..ca76a9e778e 100644
--- a/code/game/gamemodes/miniantags/morph/spells/reproduce.dm
+++ b/code/game/gamemodes/miniantags/morph/spells/reproduce.dm
@@ -2,7 +2,7 @@
name = "Reproduce"
desc = "Split yourself in half making a new morph. Can only be used while on a floor. Makes you temporarily unable to vent crawl."
hunger_cost = 150 // 5 humans
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
action_icon_state = "morph_reproduce"
create_attack_logs = FALSE
diff --git a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
index 960e780ca7f..87e5ba42628 100644
--- a/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
+++ b/code/game/gamemodes/miniantags/revenant/revenant_abilities.dm
@@ -107,7 +107,7 @@
//Toggle night vision: lets the revenant toggle its night vision
/obj/effect/proc_holder/spell/night_vision/revenant
- charge_max = 0
+ base_cooldown = 0
panel = "Revenant Abilities"
message = "You toggle your night vision."
action_icon_state = "r_nightvision"
@@ -118,7 +118,7 @@
name = "Transmit"
desc = "Telepathically transmits a message to the target."
panel = "Revenant Abilities"
- charge_max = 0
+ base_cooldown = 0
clothes_req = FALSE
action_icon_state = "r_transmit"
action_background_icon_state = "bg_revenant"
@@ -133,7 +133,7 @@
spawn(0)
var/msg = stripped_input(user, "What do you wish to tell [M]?", null, "")
if(!msg)
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
return
log_say("(REVENANT to [key_name(M)]) [msg]", user)
to_chat(user, "You transmit to [M]: [msg]")
@@ -161,7 +161,7 @@
/obj/effect/proc_holder/spell/aoe_turf/revenant/can_cast(mob/living/simple_animal/revenant/user = usr, charge_check = TRUE, show_message = FALSE)
if(user.inhibited)
return FALSE
- if(charge_counter < charge_max)
+ if(cooldown_handler.is_on_cooldown())
return FALSE
if(locked)
if(user.essence <= unlock_amount)
@@ -173,16 +173,16 @@
/obj/effect/proc_holder/spell/aoe_turf/revenant/proc/attempt_cast(mob/living/simple_animal/revenant/user = usr)
if(locked)
if(!user.castcheck(-unlock_amount))
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
return FALSE
name = "[initial(name)] ([cast_amount]E)"
to_chat(user, "You have unlocked [initial(name)]!")
panel = "Revenant Abilities"
locked = FALSE
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
return FALSE
if(!user.castcheck(-cast_amount))
- charge_counter = charge_max
+ cooldown_handler.revert_cast()
return FALSE
name = "[initial(name)] ([cast_amount]E)"
user.reveal(reveal)
@@ -195,7 +195,7 @@
/obj/effect/proc_holder/spell/aoe_turf/revenant/overload
name = "Overload Lights"
desc = "Directs a large amount of essence into nearby electrical lights, causing lights to shock those nearby."
- charge_max = 200
+ base_cooldown = 200
stun = 30
cast_amount = 45
var/shock_range = 2
@@ -238,7 +238,7 @@
/obj/effect/proc_holder/spell/aoe_turf/revenant/defile
name = "Defile"
desc = "Twists and corrupts the nearby area as well as dispelling holy auras on floors."
- charge_max = 150
+ base_cooldown = 150
stun = 10
reveal = 40
unlock_amount = 75
@@ -262,7 +262,7 @@
/obj/effect/proc_holder/spell/aoe_turf/revenant/malfunction
name = "Malfunction"
desc = "Corrupts and damages nearby machines and mechanical objects."
- charge_max = 200
+ base_cooldown = 200
cast_amount = 45
unlock_amount = 150
action_icon_state = "malfunction"
diff --git a/code/game/gamemodes/miniantags/slaughter/slaughter.dm b/code/game/gamemodes/miniantags/slaughter/slaughter.dm
index 79de9ac744a..b0d71f6413f 100644
--- a/code/game/gamemodes/miniantags/slaughter/slaughter.dm
+++ b/code/game/gamemodes/miniantags/slaughter/slaughter.dm
@@ -139,7 +139,7 @@
/obj/effect/proc_holder/spell/sense_victims
name = "Sense Victims"
desc = "Sense the location of heretics"
- charge_max = 0
+ base_cooldown = 0
clothes_req = FALSE
cooldown_min = 0
overlay = null
diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm
index 887370655b3..8f03ced04f9 100644
--- a/code/game/gamemodes/wizard/spellbook.dm
+++ b/code/game/gamemodes/wizard/spellbook.dm
@@ -31,9 +31,7 @@
else
aspell.name = initial(aspell.name)
aspell.spell_level++
- aspell.charge_max = round(initial(aspell.charge_max) - aspell.spell_level * (initial(aspell.charge_max) - aspell.cooldown_min) / aspell.level_max)
- if(aspell.charge_max < aspell.charge_counter)
- aspell.charge_counter = aspell.charge_max
+ aspell.cooldown_handler.recharge_duration = round(aspell.base_cooldown - aspell.spell_level * (aspell.base_cooldown - aspell.cooldown_min) / aspell.level_max)
switch(aspell.spell_level)
if(1)
to_chat(user, "You have improved [aspell.name] into Efficient [aspell.name].")
@@ -89,8 +87,7 @@
S = new spell_type()
var/dat =""
dat += "[name]"
- if(S.charge_type == "recharge")
- dat += " Cooldown:[S.charge_max/10]"
+ dat += " Cooldown:[S.base_cooldown/10]"
dat += " Cost:[cost]
"
dat += "[S.desc][desc]
"
dat += "[S.clothes_req?"Needs wizard garb":"Can be cast without wizard garb"]
"
diff --git a/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm b/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm
index 6221f685b03..c46ee037fdf 100644
--- a/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm
+++ b/code/modules/antagonists/vampire/vampire_powers/dantalion_powers.dm
@@ -80,7 +80,7 @@
desc = "Talk to your thralls telepathically."
gain_desc = "You have gained the ability to commune with your thralls."
action_icon_state = "vamp_communication"
- charge_max = 2 SECONDS
+ base_cooldown = 2 SECONDS
/obj/effect/proc_holder/spell/vampire/thrall_commune/create_new_handler() //so thralls can use it
return
@@ -129,7 +129,7 @@
desc = "Pacify a target temporarily, making them unable to cause harm."
gain_desc = "You have gained the ability to pacify someone's harmful tendencies, preventing them from doing any physical harm to anyone."
action_icon_state = "pacify"
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
required_blood = 10
/obj/effect/proc_holder/spell/vampire/pacify/create_new_targeting()
@@ -149,7 +149,7 @@
gain_desc = "You have gained the ability to turn invisible and create decoy illusions."
action_icon_state = "decoy"
required_blood = 30
- charge_max = 40 SECONDS
+ base_cooldown = 40 SECONDS
/obj/effect/proc_holder/spell/vampire/self/decoy/cast(list/targets, mob/user)
var/mob/living/simple_animal/hostile/illusion/escape/E = new(get_turf(user))
@@ -165,7 +165,7 @@
gain_desc = "You have gained the ability to remove all incapacitating effects from nearby thralls."
action_icon_state = "thralls_up"
required_blood = 100
- charge_max = 100 SECONDS
+ base_cooldown = 100 SECONDS
/obj/effect/proc_holder/spell/vampire/rally_thralls/create_new_targeting()
var/datum/spell_targeting/aoe/thralls/A = new
@@ -192,7 +192,7 @@
gain_desc = "You have gained the ability to make everyone nearby percieve others to looks like random animals after briefly blinding them."
action_icon_state = "hysteria"
required_blood = 70
- charge_max = 180 SECONDS
+ base_cooldown = 180 SECONDS
/obj/effect/proc_holder/spell/vampire/hysteria/create_new_targeting()
var/datum/spell_targeting/aoe/A = new
diff --git a/code/modules/antagonists/vampire/vampire_powers/gargantua_powers.dm b/code/modules/antagonists/vampire/vampire_powers/gargantua_powers.dm
index c64a30c0bdb..6ac19e5cf45 100644
--- a/code/modules/antagonists/vampire/vampire_powers/gargantua_powers.dm
+++ b/code/modules/antagonists/vampire/vampire_powers/gargantua_powers.dm
@@ -2,7 +2,7 @@
name = "Blood Swell (30)"
desc = "You infuse your body with blood, making you highly resistant to stuns and physical damage. However, this makes you unable to fire ranged weapons while it is active."
gain_desc = "You have gained the ability to temporarly resist large amounts of stuns and physical damage."
- charge_max = 40 SECONDS
+ base_cooldown = 40 SECONDS
required_blood = 30
action_icon_state = "blood_swell"
@@ -19,7 +19,7 @@
name = "Overwhelming Force"
desc = "When toggled you will automatically pry open doors that you bump into if you do not have access."
gain_desc = "You have gained the ability to force open doors at a small blood cost."
- charge_max = 2 SECONDS
+ base_cooldown = 2 SECONDS
action_icon_state = "OH_YEAAAAH"
/obj/effect/proc_holder/spell/vampire/self/overwhelming_force/cast(list/targets, mob/user)
@@ -37,7 +37,7 @@
name = "Blood Rush (30)"
desc = "Infuse yourself with blood magic to boost your movement speed."
gain_desc = "You have gained the ability to temporarily move at high speeds."
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
required_blood = 30
action_icon_state = "blood_rush"
@@ -53,7 +53,7 @@
desc = "You charge at wherever you click on screen, dealing large amounts of damage, stunning and destroying walls and other objects."
gain_desc = "You can now charge at a target on screen, dealing massive damage and destroying structures."
required_blood = 30
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
action_icon_state = "vampire_charge"
/obj/effect/proc_holder/spell/vampire/charge/create_new_targeting()
diff --git a/code/modules/antagonists/vampire/vampire_powers/hemomancer_powers.dm b/code/modules/antagonists/vampire/vampire_powers/hemomancer_powers.dm
index aedfd994b9c..da15d2e573c 100644
--- a/code/modules/antagonists/vampire/vampire_powers/hemomancer_powers.dm
+++ b/code/modules/antagonists/vampire/vampire_powers/hemomancer_powers.dm
@@ -2,7 +2,7 @@
name = "Vampiric Claws (30)"
desc = "You channel blood magics to forge deadly vampiric claws that leech blood and strike rapidly. Cannot be used if you are holding something that cannot be dropped."
gain_desc = "You have gained the ability to forge your hands into vampiric claws."
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
required_blood = 30
action_icon_state = "vampire_claws"
@@ -91,7 +91,7 @@
gain_desc = "You have gained the ability to summon blood tendrils to slow people down in an area that you target."
required_blood = 10
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
action_icon_state = "blood_tendrils"
sound = 'sound/misc/enter_blood.ogg'
var/area_of_affect = 1
@@ -157,7 +157,7 @@
desc = "Every pool of blood in 4 tiles erupts with a spike of living blood, damaging anyone stood on it."
gain_desc = "You have gained the ability to weaponise pools of blood to damage those stood on them."
required_blood = 100
- charge_max = 200 SECONDS
+ base_cooldown = 200 SECONDS
action_icon_state = "blood_spikes"
/obj/effect/proc_holder/spell/vampire/blood_eruption/create_new_targeting()
@@ -193,7 +193,7 @@
name = "The Blood Bringers Rite"
desc = "When toggled, everyone around you begins to bleed profusely."
gain_desc = "You have gained the ability to rip the very life force out of people and absorb it, healing you."
- charge_max = 10 SECONDS
+ base_cooldown = 10 SECONDS
action_icon_state = "blood_bringers_rite"
required_blood = 10
diff --git a/code/modules/antagonists/vampire/vampire_powers/umbrae_powers.dm b/code/modules/antagonists/vampire/vampire_powers/umbrae_powers.dm
index b1df1a74551..86e2aac6c09 100644
--- a/code/modules/antagonists/vampire/vampire_powers/umbrae_powers.dm
+++ b/code/modules/antagonists/vampire/vampire_powers/umbrae_powers.dm
@@ -3,7 +3,7 @@
desc = "Toggles whether you are currently cloaking yourself in darkness. When in darkness and toggled on, you move at increased speeds."
gain_desc = "You have gained the Cloak of Darkness ability, which when toggled makes you nearly invisible and highly agile in the shroud of darkness."
action_icon_state = "vampire_cloak"
- charge_max = 2 SECONDS
+ base_cooldown = 2 SECONDS
/obj/effect/proc_holder/spell/vampire/self/cloak/New()
..()
@@ -43,7 +43,7 @@
name = "Shadow Snare (20)"
desc = "You summon a trap on the ground. When crossed it will blind the target, extinguish any lights they may have, and ensnare them."
gain_desc = "You have gained the ability to summon a trap that will blind, ensnare, and turn off the lights of anyone who crosses it."
- charge_max = 20 SECONDS
+ base_cooldown = 20 SECONDS
required_blood = 20
action_icon_state = "shadow_snare"
@@ -110,7 +110,7 @@
name = "Dark Passage (30)"
desc = "You teleport to a targeted turf."
gain_desc = "You have gained the ability to blink a short distance towards a targeted turf."
- charge_max = 40 SECONDS
+ base_cooldown = 40 SECONDS
required_blood = 30
centcom_cancast = FALSE
action_icon_state = "dark_passage"
@@ -137,7 +137,7 @@
name = "Extinguish"
desc = "You extinguish any light source in an area around you."
gain_desc = "You have gained the ability to extinguish nearby light sources."
- charge_max = 20 SECONDS
+ base_cooldown = 20 SECONDS
action_icon_state = "vampire_extinguish"
create_attack_logs = FALSE
create_custom_logs = TRUE
@@ -156,7 +156,7 @@
name = "Eternal Darkness"
desc = "When toggled, you shroud the area around you in darkness and slowly lower the body temperature of people nearby."
gain_desc = "You have gained the ability to shroud the area around you in darkness, only the strongest of lights can pierce your unholy powers."
- charge_max = 10 SECONDS
+ base_cooldown = 10 SECONDS
action_icon_state = "eternal_darkness"
required_blood = 5
var/shroud_power = -4
diff --git a/code/modules/antagonists/vampire/vampire_powers/vampire_powers.dm b/code/modules/antagonists/vampire/vampire_powers/vampire_powers.dm
index f3f27d040f2..a9780ea4cfb 100644
--- a/code/modules/antagonists/vampire/vampire_powers/vampire_powers.dm
+++ b/code/modules/antagonists/vampire/vampire_powers/vampire_powers.dm
@@ -51,7 +51,7 @@
name = "Rejuvenate"
desc = "Use reserve blood to enliven your body, removing any incapacitating effects."
action_icon_state = "vampire_rejuvinate"
- charge_max = 20 SECONDS
+ base_cooldown = 20 SECONDS
stat_allowed = UNCONSCIOUS
/obj/effect/proc_holder/spell/vampire/self/rejuvenate/cast(list/targets, mob/user = usr)
@@ -97,7 +97,7 @@
name = "Choose Specialization"
desc = "Choose what sub-class of vampire you want to evolve into."
gain_desc = "You can now choose what specialization of vampire you want to evolve into."
- charge_max = 2 SECONDS
+ base_cooldown = 2 SECONDS
action_icon_state = "select_class"
/obj/effect/proc_holder/spell/vampire/self/specialize/cast(mob/user)
@@ -155,7 +155,7 @@
name = "Glare"
desc = "Your eyes flash, stunning and silencing anyone infront of you. It has lesser effects for those around you."
action_icon_state = "vampire_glare"
- charge_max = 30 SECONDS
+ base_cooldown = 30 SECONDS
stat_allowed = UNCONSCIOUS
/obj/effect/proc_holder/spell/vampire/glare/create_new_targeting()
@@ -254,7 +254,7 @@
name = "Raise Vampires"
desc = "Summons deadly vampires from bluespace."
school = "transmutation"
- charge_max = 100
+ base_cooldown = 100
clothes_req = FALSE
human_req = TRUE
invocation = "none"
@@ -328,7 +328,7 @@
desc = "Teleport to a nearby dark region"
gain_desc = "You have gained the ability to shadowstep, which makes you disappear into nearby shadows at the cost of blood."
action_icon_state = "shadowblink"
- charge_max = 2 SECONDS
+ base_cooldown = 2 SECONDS
clothes_req = FALSE
centcom_cancast = FALSE
include_space = FALSE
diff --git a/code/modules/mining/lavaland/loot/colossus_loot.dm b/code/modules/mining/lavaland/loot/colossus_loot.dm
index 7d67bfc2434..c5548890a85 100644
--- a/code/modules/mining/lavaland/loot/colossus_loot.dm
+++ b/code/modules/mining/lavaland/loot/colossus_loot.dm
@@ -392,7 +392,7 @@
/obj/effect/proc_holder/spell/exit_possession
name = "Exit Possession"
desc = "Exits the body you are possessing"
- charge_max = 60
+ base_cooldown = 60
clothes_req = FALSE
invocation_type = "none"
action_icon_state = "exit_possession"
diff --git a/code/modules/mob/dead/observer/spells.dm b/code/modules/mob/dead/observer/spells.dm
index 95531e3063e..60777a4718d 100644
--- a/code/modules/mob/dead/observer/spells.dm
+++ b/code/modules/mob/dead/observer/spells.dm
@@ -19,7 +19,7 @@ GLOBAL_LIST_INIT(boo_phrases, list(
action_icon_state = "boo"
school = "transmutation"
- charge_max = 2 MINUTES
+ base_cooldown = 2 MINUTES
starts_charged = FALSE
clothes_req = FALSE
stat_allowed = UNCONSCIOUS
@@ -43,7 +43,7 @@ GLOBAL_LIST_INIT(boo_phrases, list(
var/area/spook_zone = get_area(target)
if (spook_zone.is_haunted == TRUE)
to_chat(usr, "The veil is weak in [spook_zone], it took less effort to influence [target].")
- charge_counter = charge_max / 2
+ cooldown_handler.start_recharge(cooldown_handler.recharge_duration / 2)
return
- charge_counter = charge_max * 0.9 // We've targetted a non-spookable object! Try again fast!
+ cooldown_handler.start_recharge(cooldown_handler.recharge_duration * 0.1)
diff --git a/code/modules/mob/living/carbon/superheroes.dm b/code/modules/mob/living/carbon/superheroes.dm
index 4127be9548d..747cef5d2ef 100644
--- a/code/modules/mob/living/carbon/superheroes.dm
+++ b/code/modules/mob/living/carbon/superheroes.dm
@@ -147,7 +147,7 @@
/obj/effect/proc_holder/spell/recruit
name = "Recruit Greyshirt"
desc = "Allows you to recruit a conscious, non-braindead, non-catatonic human to be part of the Greyshirts, your personal henchmen. This works on Assistants only and you can recruit a maximum of 3!."
- charge_max = 450
+ base_cooldown = 450
clothes_req = FALSE
action_icon_state = "spell_greytide"
var/recruiting = 0
diff --git a/code/modules/mob/living/simple_animal/hostile/hellhound.dm b/code/modules/mob/living/simple_animal/hostile/hellhound.dm
index d451c015fa9..d4020a9b47a 100644
--- a/code/modules/mob/living/simple_animal/hostile/hellhound.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hellhound.dm
@@ -134,7 +134,7 @@
AddSpell(wallspell)
// Offense
var/obj/effect/proc_holder/spell/aoe_turf/conjure/creature/summonspell = new
- summonspell.charge_max = 1
+ summonspell.base_cooldown = 1
summonspell.invocation_type = "none"
summonspell.summon_type = list(/mob/living/simple_animal/hostile/hellhound)
summonspell.summon_amt = 1
diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
index 08a8819831d..b372d74cc66 100644
--- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
+++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
@@ -643,7 +643,7 @@ Difficulty: Medium
name = "Tail Sweep"
desc = "Throw back attackers with a sweep of your tail."
sound = 'sound/magic/tail_swing.ogg'
- charge_max = 150
+ base_cooldown = 150
clothes_req = FALSE
cooldown_min = 150
invocation_type = "none"
diff --git a/code/modules/mob/living/simple_animal/hostile/statue.dm b/code/modules/mob/living/simple_animal/hostile/statue.dm
index a72dad6f6e6..9ccbce6f6fd 100644
--- a/code/modules/mob/living/simple_animal/hostile/statue.dm
+++ b/code/modules/mob/living/simple_animal/hostile/statue.dm
@@ -160,7 +160,7 @@
name = "Flicker Lights"
desc = "You will trigger a large amount of lights around you to flicker."
- charge_max = 300
+ base_cooldown = 300
clothes_req = FALSE
/obj/effect/proc_holder/spell/aoe_turf/flicker_lights/create_new_targeting()
@@ -180,7 +180,7 @@
desc = "Your prey will be momentarily blind for you to advance on them."
message = "You glare your eyes."
- charge_max = 600
+ base_cooldown = 600
clothes_req = FALSE
/obj/effect/proc_holder/spell/aoe_turf/blindness/create_new_targeting()
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 5c885a06add..ea0b2411c7e 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1052,13 +1052,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
statpanel(listed_turf.name, null, statpanel_things)
/mob/proc/add_spell_to_statpanel(obj/effect/proc_holder/spell/S)
- switch(S.charge_type)
- if("recharge")
- statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S)
- if("charges")
- statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S)
- if("holdervar")
- statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S)
+ statpanel(S.panel,"[round(S.cooldown_handler.get_availability_percentage(), 0.01) * 100]%",S)
// facing verbs
/mob/proc/canface()
diff --git a/paradise.dme b/paradise.dme
index fbf2d7f0903..5158b8c3f83 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -445,6 +445,8 @@
#include "code\datums\outfits\vv_outfit.dm"
#include "code\datums\ruins\lavaland.dm"
#include "code\datums\ruins\space.dm"
+#include "code\datums\spell_cooldown\spell_charges.dm"
+#include "code\datums\spell_cooldown\spell_cooldown.dm"
#include "code\datums\spell_handler\morph.dm"
#include "code\datums\spell_handler\spell_handler.dm"
#include "code\datums\spell_handler\vampire.dm"