diff --git a/code/game/gamemodes/wizard/spellbook.dm b/code/game/gamemodes/wizard/spellbook.dm
index e9e1a95e73..fe2c0cde56 100644
--- a/code/game/gamemodes/wizard/spellbook.dm
+++ b/code/game/gamemodes/wizard/spellbook.dm
@@ -253,7 +253,7 @@
/datum/spellbook_entry/the_traps
name = "The Traps!"
spell_type = /obj/effect/proc_holder/spell/aoe_turf/conjure/the_traps
- category = "Offensive"
+ category = "Defensive"
cost = 1
diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm
index 90500f14db..dad4e9b53e 100644
--- a/code/game/objects/structures/traps.dm
+++ b/code/game/objects/structures/traps.dm
@@ -8,8 +8,10 @@
alpha = 30 //initially quite hidden when not "recharging"
var/last_trigger = 0
var/time_between_triggers = 600 //takes a minute to recharge
+ var/charges = INFINITY
var/list/static/ignore_typecache
+ var/list/mob/immune_minds = list()
var/datum/effect_system/spark_spread/spark_system
@@ -30,9 +32,11 @@
. = ..()
/obj/structure/trap/examine(mob/user)
- ..()
+ . = ..()
if(!isliving(user))
return
+ if(user.mind && user.mind in immune_minds)
+ return
if(get_dist(user, src) <= 1)
to_chat(user, "You reveal [src]!")
flare()
@@ -41,10 +45,15 @@
// Makes the trap visible, and starts the cooldown until it's
// able to be triggered again.
visible_message("[src] flares brightly!")
- alpha = 200
- animate(src, alpha = initial(alpha), time = time_between_triggers)
- last_trigger = world.time
spark_system.start()
+ alpha = 200
+ last_trigger = world.time
+ charges--
+ if(charges <= 0)
+ animate(src, alpha = 0, time = 10)
+ QDEL_IN(src, 10)
+ else
+ animate(src, alpha = initial(alpha), time = time_between_triggers)
/obj/structure/trap/Crossed(atom/movable/AM)
if(last_trigger + time_between_triggers > world.time)
@@ -52,6 +61,12 @@
// Don't want the traps triggered by sparks, ghosts or projectiles.
if(is_type_in_typecache(AM, ignore_typecache))
return
+ if(ismob(AM))
+ var/mob/M = AM
+ if(M.mind in immune_minds)
+ return
+ if(charges <= 0)
+ return
flare()
if(isliving(AM))
trap_effect(AM)
diff --git a/code/modules/spells/spell_types/conjure.dm b/code/modules/spells/spell_types/conjure.dm
index 4785ebdc6f..f3f628e5d9 100644
--- a/code/modules/spells/spell_types/conjure.dm
+++ b/code/modules/spells/spell_types/conjure.dm
@@ -42,6 +42,11 @@
if(summon_lifespan)
QDEL_IN(summoned_object, summon_lifespan)
+ post_summon(summoned_object, user)
+
+/obj/effect/proc_holder/spell/aoe_turf/conjure/proc/post_summon(atom/summoned_object, mob/user)
+ return
+
/obj/effect/proc_holder/spell/aoe_turf/conjure/summonEdSwarm //test purposes - Also a lot of fun
name = "Dispense Wizard Justice"
desc = "This spell dispenses wizard justice."
diff --git a/code/modules/spells/spell_types/the_traps.dm b/code/modules/spells/spell_types/the_traps.dm
index ca3da76617..169a38bb95 100644
--- a/code/modules/spells/spell_types/the_traps.dm
+++ b/code/modules/spells/spell_types/the_traps.dm
@@ -3,7 +3,7 @@
desc = "Summon a number of traps to confuse and weaken your enemies, and possibly you."
charge_max = 250
- cooldown_min = 100
+ cooldown_min = 50
clothes_req = 1
invocation = "CAVERE INSIDIAS"
@@ -14,10 +14,13 @@
/obj/structure/trap/stun,
/obj/structure/trap/fire,
/obj/structure/trap/chill,
- /obj/structure/trap/damage,
- /obj/structure/swarmer/trap
+ /obj/structure/trap/damage
)
- summon_lifespan = 0
+ summon_lifespan = 3000
summon_amt = 5
action_icon_state = "the_traps"
+
+/obj/effect/proc_holder/spell/aoe_turf/conjure/the_traps/post_summon(obj/structure/trap/T, mob/user)
+ T.immune_minds += user.mind
+ T.charges = 1