160175ee8b
Yeah uhh this'll probably need testmerging even after it's done because yeah it's a bit big. If y'all want me to atomize this into two PRs (pass flags vs projectiles) tell me please. Pass flags would have to go in first though, in that case, as new projectile hit handling will rely on pass_flags_self. Pass flags: Pass flags handling now uses an atom variable named pass_flags_self. If any of these match a pass_flag on a thing trying to pass through, it's allowed through by default. This makes overriding CanAllowThrough unnecessary for the majority of things. I've however not removed overrides for very.. weird cases, like plastic flaps which uses a prob(60) for letting PASSGLASS things through for god knows why. LETPASSTHROW is now on pass_flags_self Projectiles: Not finalized yet, need to do something to make the system I have in mind have less unneeded overhead + snowflake Basically, for piercing/phasing/otherwise projectiles that go through things instead of hitting the first dense object, I have them use pass_flags flags for two new variables, projectile_phasing and projectile_piercing. Anything with pass_flags_self in the former gets phased through entirely. Anything in the latter gets hit, and the projectile then goes through. on_hit will also register a piercing hit vs a normal hit (so things like missiles can only explode on a normal hit or otherwise, instead of exploding multiple times. Not needed as missiles qdel(src) right now but it's nice to have for the future). I still need to decide what to do for hit handling proper, as Bump() is still preferred due to it not being as high-overhead as something like scanning on Moved(). I'm thinking I'll make Moved() only scan for cases where it needs to hit a non-dense object - a prone human the user clicked on, anything special like that. Don't know the exact specifics yet, which is why this is still WIP. Projectiles now use check_pierce() to determine if it goes through something and hits it, doesn't hit it, or doesn't go through something at all (should delete self after hitting). Will likely make an on_pierce proc to be called post-piercing something so you can have !fun! things like projectiles that go down in damage after piercing something. This will likely deprecate the process_hit proc, or at least make it less awful. scan_for_hit() is now used to attempt to hit something and will return whether the projectile got deleted or not. It will delete the projectile if the projectile does hit something and fails to pierce through it. scan_moved_turf() (WIP) will be used for handling moving onto a turf. permutated has been renamed to impacted. Ricocheting projectiles get it reset, allowing projectiles to pierce and potentially hit something again if it goes back around. A new unit test has been added checking for projectiles with movement type of PHASING. This is because PHASING completely causes projectiles to break down as projectiles mainly sense collisions through Bump. The small boost in performance from using PHASING instead of having all pass flags active/overriding check_pierce is in my opinion not worth the extra snowflake in scan_moved_turf() I'd have to do to deal with having to check for hits manually rather than Bump()ing things. Movement types UNSTOPPABLE renamed to PHASING to better describe what it is, going through and crossing everything but not actually bumping. Why It's Good For The Game Better pass flags handling allows for less proc overrides, bitflag checks are far less expensive in general. Fixes penetrating projectiles like sniper penetrators This system also allows for better handling of piercing projectiles (see above) without too much snowflake code, as you'd only need to modify on_pierce() if you needed to do special handling like dampening damage per target pierced, and otherwise you could just use the standardized system and just set pass flags to what's needed. If you really need a projectile that pierces almost everything, override check_pierce(), which is still going to be easier than what was done before (even with snowflake handling of UNSTOPPABLE flag process_hit() was extremely ugly, now we don't rely on movement types at all.)
704 lines
22 KiB
Plaintext
704 lines
22 KiB
Plaintext
/obj/projectile/magic
|
|
name = "bolt"
|
|
icon_state = "energy"
|
|
damage = 0
|
|
damage_type = OXY
|
|
nodamage = TRUE
|
|
armour_penetration = 100
|
|
flag = MAGIC
|
|
|
|
/obj/projectile/magic/death
|
|
name = "bolt of death"
|
|
icon_state = "pulse1_bl"
|
|
|
|
/obj/projectile/magic/death/on_hit(mob/living/target)
|
|
. = ..()
|
|
if(!istype(target))
|
|
return
|
|
|
|
if(target.anti_magic_check())
|
|
target.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
|
|
if(target.mob_biotypes & MOB_UNDEAD) //negative energy heals the undead
|
|
if(target.revive(full_heal = TRUE, admin_revive = TRUE))
|
|
target.grab_ghost(force = TRUE) // even suicides
|
|
to_chat(target, "<span class='notice'>You rise with a start, you're undead!!!</span>")
|
|
else if(target.stat != DEAD)
|
|
to_chat(target, "<span class='notice'>You feel great!</span>")
|
|
return
|
|
|
|
target.death()
|
|
|
|
/obj/projectile/magic/resurrection
|
|
name = "bolt of resurrection"
|
|
icon_state = "ion"
|
|
damage = 0
|
|
damage_type = OXY
|
|
nodamage = TRUE
|
|
|
|
/obj/projectile/magic/resurrection/on_hit(mob/living/carbon/target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
if(target.anti_magic_check())
|
|
target.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
if(target.mob_biotypes & MOB_UNDEAD) //positive energy harms the undead
|
|
target.death(0)
|
|
else
|
|
if(target.revive(full_heal = TRUE, admin_revive = TRUE))
|
|
target.grab_ghost(force = TRUE) // even suicides
|
|
to_chat(target, "<span class='notice'>You rise with a start, you're alive!!!</span>")
|
|
else if(target.stat != DEAD)
|
|
to_chat(target, "<span class='notice'>You feel great!</span>")
|
|
|
|
/obj/projectile/magic/teleport
|
|
name = "bolt of teleportation"
|
|
icon_state = "bluespace"
|
|
damage = 0
|
|
damage_type = OXY
|
|
nodamage = TRUE
|
|
var/inner_tele_radius = 0
|
|
var/outer_tele_radius = 6
|
|
|
|
/obj/projectile/magic/teleport/on_hit(mob/target)
|
|
. = ..()
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
var/teleammount = 0
|
|
var/teleloc = target
|
|
if(!isturf(target))
|
|
teleloc = target.loc
|
|
for(var/atom/movable/stuff in teleloc)
|
|
if(!stuff.anchored && stuff.loc && !isobserver(stuff))
|
|
if(do_teleport(stuff, stuff, 10, channel = TELEPORT_CHANNEL_MAGIC))
|
|
teleammount++
|
|
var/datum/effect_system/smoke_spread/smoke = new
|
|
smoke.set_up(max(round(4 - teleammount),0), stuff.loc) //Smoke drops off if a lot of stuff is moved for the sake of sanity
|
|
smoke.start()
|
|
|
|
/obj/projectile/magic/safety
|
|
name = "bolt of safety"
|
|
icon_state = "bluespace"
|
|
damage = 0
|
|
damage_type = OXY
|
|
nodamage = TRUE
|
|
|
|
/obj/projectile/magic/safety/on_hit(atom/target)
|
|
. = ..()
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
if(isturf(target))
|
|
return BULLET_ACT_HIT
|
|
|
|
var/turf/origin_turf = get_turf(target)
|
|
var/turf/destination_turf = find_safe_turf()
|
|
|
|
if(do_teleport(target, destination_turf, channel=TELEPORT_CHANNEL_MAGIC))
|
|
for(var/t in list(origin_turf, destination_turf))
|
|
var/datum/effect_system/smoke_spread/smoke = new
|
|
smoke.set_up(0, t)
|
|
smoke.start()
|
|
|
|
/obj/projectile/magic/door
|
|
name = "bolt of door creation"
|
|
icon_state = "energy"
|
|
damage = 0
|
|
damage_type = OXY
|
|
nodamage = TRUE
|
|
var/list/door_types = list(/obj/structure/mineral_door/wood, /obj/structure/mineral_door/iron, /obj/structure/mineral_door/silver, /obj/structure/mineral_door/gold, /obj/structure/mineral_door/uranium, /obj/structure/mineral_door/sandstone, /obj/structure/mineral_door/transparent/plasma, /obj/structure/mineral_door/transparent/diamond)
|
|
|
|
/obj/projectile/magic/door/on_hit(atom/target)
|
|
. = ..()
|
|
if(istype(target, /obj/machinery/door))
|
|
OpenDoor(target)
|
|
else
|
|
var/turf/T = get_turf(target)
|
|
if(isclosedturf(T) && !isindestructiblewall(T))
|
|
CreateDoor(T)
|
|
|
|
/obj/projectile/magic/door/proc/CreateDoor(turf/T)
|
|
var/door_type = pick(door_types)
|
|
var/obj/structure/mineral_door/D = new door_type(T)
|
|
T.ChangeTurf(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
|
D.Open()
|
|
|
|
/obj/projectile/magic/door/proc/OpenDoor(obj/machinery/door/D)
|
|
if(istype(D, /obj/machinery/door/airlock))
|
|
var/obj/machinery/door/airlock/A = D
|
|
A.locked = FALSE
|
|
D.open()
|
|
|
|
/obj/projectile/magic/change
|
|
name = "bolt of change"
|
|
icon_state = "ice_1"
|
|
damage = 0
|
|
damage_type = BURN
|
|
nodamage = TRUE
|
|
|
|
/obj/projectile/magic/change/on_hit(atom/change)
|
|
. = ..()
|
|
if(ismob(change))
|
|
var/mob/M = change
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] fizzles on contact with [M]!</span>")
|
|
qdel(src)
|
|
return BULLET_ACT_BLOCK
|
|
wabbajack(change)
|
|
qdel(src)
|
|
|
|
/proc/wabbajack(mob/living/M, randomize)
|
|
// If the mob has a shapeshifted form, we want to pull out the reference of the caster's original body from it.
|
|
// We then want to restore this original body through the shapeshift holder itself.
|
|
var/obj/shapeshift_holder/shapeshift = locate() in M
|
|
if(shapeshift)
|
|
M = shapeshift.stored
|
|
shapeshift.restore()
|
|
|
|
if(!istype(M) || M.stat == DEAD || M.notransform || (GODMODE & M.status_flags))
|
|
return
|
|
|
|
M.notransform = TRUE
|
|
ADD_TRAIT(M, TRAIT_IMMOBILIZED, MAGIC_TRAIT)
|
|
ADD_TRAIT(M, TRAIT_HANDS_BLOCKED, MAGIC_TRAIT)
|
|
M.icon = null
|
|
M.cut_overlays()
|
|
M.invisibility = INVISIBILITY_ABSTRACT
|
|
|
|
var/list/contents = M.contents.Copy()
|
|
|
|
if(iscyborg(M))
|
|
var/mob/living/silicon/robot/Robot = M
|
|
// Disconnect AI's in shells
|
|
if(Robot.connected_ai)
|
|
Robot.connected_ai.disconnect_shell()
|
|
if(Robot.mmi)
|
|
qdel(Robot.mmi)
|
|
Robot.notify_ai(NEW_BORG)
|
|
else
|
|
for(var/obj/item/W in contents)
|
|
if(!M.dropItemToGround(W))
|
|
qdel(W)
|
|
|
|
var/mob/living/new_mob
|
|
|
|
if(!randomize)
|
|
randomize = pick("monkey","robot","slime","xeno","humanoid","animal")
|
|
switch(randomize)
|
|
if("monkey")
|
|
new_mob = new /mob/living/carbon/monkey(M.loc)
|
|
|
|
if("robot")
|
|
var/robot = pick(200;/mob/living/silicon/robot,
|
|
/mob/living/silicon/robot/modules/syndicate,
|
|
/mob/living/silicon/robot/modules/syndicate/medical,
|
|
/mob/living/silicon/robot/modules/syndicate/saboteur,
|
|
200;/mob/living/simple_animal/drone/polymorphed)
|
|
new_mob = new robot(M.loc)
|
|
if(issilicon(new_mob))
|
|
new_mob.gender = M.gender
|
|
new_mob.invisibility = 0
|
|
new_mob.job = "Cyborg"
|
|
var/mob/living/silicon/robot/Robot = new_mob
|
|
Robot.lawupdate = FALSE
|
|
Robot.connected_ai = null
|
|
Robot.mmi.transfer_identity(M) //Does not transfer key/client.
|
|
Robot.clear_inherent_laws(0)
|
|
Robot.clear_zeroth_law(0)
|
|
|
|
if("slime")
|
|
new_mob = new /mob/living/simple_animal/slime/random(M.loc)
|
|
|
|
if("xeno")
|
|
var/Xe
|
|
if(M.ckey)
|
|
Xe = pick(/mob/living/carbon/alien/humanoid/hunter,/mob/living/carbon/alien/humanoid/sentinel)
|
|
else
|
|
Xe = pick(/mob/living/carbon/alien/humanoid/hunter,/mob/living/simple_animal/hostile/alien/sentinel)
|
|
new_mob = new Xe(M.loc)
|
|
|
|
if("animal")
|
|
var/path = pick(/mob/living/simple_animal/hostile/carp,
|
|
/mob/living/simple_animal/hostile/bear,
|
|
/mob/living/simple_animal/hostile/mushroom,
|
|
/mob/living/simple_animal/hostile/statue,
|
|
/mob/living/simple_animal/hostile/retaliate/bat,
|
|
/mob/living/simple_animal/hostile/retaliate/goat,
|
|
/mob/living/simple_animal/hostile/killertomato,
|
|
/mob/living/simple_animal/hostile/poison/giant_spider,
|
|
/mob/living/simple_animal/hostile/poison/giant_spider/hunter,
|
|
/mob/living/simple_animal/hostile/blob/blobbernaut/independent,
|
|
/mob/living/simple_animal/hostile/carp/ranged,
|
|
/mob/living/simple_animal/hostile/carp/ranged/chaos,
|
|
/mob/living/simple_animal/hostile/asteroid/basilisk/watcher,
|
|
/mob/living/simple_animal/hostile/asteroid/goliath/beast,
|
|
/mob/living/simple_animal/hostile/headcrab,
|
|
/mob/living/simple_animal/hostile/morph,
|
|
/mob/living/simple_animal/hostile/stickman,
|
|
/mob/living/simple_animal/hostile/stickman/dog,
|
|
/mob/living/simple_animal/hostile/megafauna/dragon/lesser,
|
|
/mob/living/simple_animal/hostile/gorilla,
|
|
/mob/living/simple_animal/parrot,
|
|
/mob/living/simple_animal/pet/dog/corgi,
|
|
/mob/living/simple_animal/crab,
|
|
/mob/living/simple_animal/pet/dog/pug,
|
|
/mob/living/simple_animal/pet/cat,
|
|
/mob/living/simple_animal/mouse,
|
|
/mob/living/simple_animal/chicken,
|
|
/mob/living/simple_animal/cow,
|
|
/mob/living/simple_animal/hostile/lizard,
|
|
/mob/living/simple_animal/pet/fox,
|
|
/mob/living/simple_animal/butterfly,
|
|
/mob/living/simple_animal/pet/cat/cak,
|
|
/mob/living/simple_animal/chick)
|
|
new_mob = new path(M.loc)
|
|
|
|
if("humanoid")
|
|
new_mob = new /mob/living/carbon/human(M.loc)
|
|
|
|
if(prob(50))
|
|
var/list/chooseable_races = list()
|
|
for(var/speciestype in subtypesof(/datum/species))
|
|
var/datum/species/S = speciestype
|
|
if(initial(S.changesource_flags) & WABBAJACK)
|
|
chooseable_races += speciestype
|
|
|
|
if(chooseable_races.len)
|
|
new_mob.set_species(pick(chooseable_races))
|
|
|
|
var/datum/preferences/A = new() //Randomize appearance for the human
|
|
A.copy_to(new_mob, icon_updates=0)
|
|
|
|
var/mob/living/carbon/human/H = new_mob
|
|
H.update_body()
|
|
H.update_hair()
|
|
H.update_body_parts()
|
|
H.dna.update_dna_identity()
|
|
|
|
if(!new_mob)
|
|
return
|
|
|
|
// Some forms can still wear some items
|
|
for(var/obj/item/W in contents)
|
|
new_mob.equip_to_appropriate_slot(W)
|
|
|
|
M.log_message("became [new_mob.real_name]", LOG_ATTACK, color="orange")
|
|
|
|
new_mob.a_intent = INTENT_HARM
|
|
|
|
M.wabbajack_act(new_mob)
|
|
|
|
to_chat(new_mob, "<span class='warning'>Your form morphs into that of a [randomize].</span>")
|
|
|
|
var/poly_msg = get_policy(POLICY_POLYMORPH)
|
|
if(poly_msg)
|
|
to_chat(new_mob, poly_msg)
|
|
|
|
M.transfer_observers_to(new_mob)
|
|
|
|
qdel(M)
|
|
return new_mob
|
|
|
|
/obj/projectile/magic/animate
|
|
name = "bolt of animation"
|
|
icon_state = "red_1"
|
|
damage = 0
|
|
damage_type = BURN
|
|
nodamage = TRUE
|
|
|
|
/obj/projectile/magic/animate/on_hit(atom/target, blocked = FALSE)
|
|
target.animate_atom_living(firer)
|
|
..()
|
|
|
|
/atom/proc/animate_atom_living(mob/living/owner = null)
|
|
if((isitem(src) || isstructure(src)) && !is_type_in_list(src, GLOB.protected_objects))
|
|
if(istype(src, /obj/structure/statue/petrified))
|
|
var/obj/structure/statue/petrified/P = src
|
|
if(P.petrified_mob)
|
|
var/mob/living/L = P.petrified_mob
|
|
var/mob/living/simple_animal/hostile/statue/S = new(P.loc, owner)
|
|
S.name = "statue of [L.name]"
|
|
if(owner)
|
|
S.faction = list("[REF(owner)]")
|
|
S.icon = P.icon
|
|
S.icon_state = P.icon_state
|
|
S.copy_overlays(P, TRUE)
|
|
S.color = P.color
|
|
S.atom_colours = P.atom_colours.Copy()
|
|
if(L.mind)
|
|
L.mind.transfer_to(S)
|
|
if(owner)
|
|
to_chat(S, "<span class='userdanger'>You are an animate statue. You cannot move when monitored, but are nearly invincible and deadly when unobserved! Do not harm [owner], your creator.</span>")
|
|
P.forceMove(S)
|
|
return
|
|
else
|
|
var/obj/O = src
|
|
if(istype(O, /obj/item/gun))
|
|
new /mob/living/simple_animal/hostile/mimic/copy/ranged(drop_location(), src, owner)
|
|
else
|
|
new /mob/living/simple_animal/hostile/mimic/copy(drop_location(), src, owner)
|
|
|
|
else if(istype(src, /mob/living/simple_animal/hostile/mimic/copy))
|
|
// Change our allegiance!
|
|
var/mob/living/simple_animal/hostile/mimic/copy/C = src
|
|
if(owner)
|
|
C.ChangeOwner(owner)
|
|
|
|
/obj/projectile/magic/spellblade
|
|
name = "blade energy"
|
|
icon_state = "lavastaff"
|
|
damage = 15
|
|
damage_type = BURN
|
|
flag = MAGIC
|
|
dismemberment = 50
|
|
nodamage = FALSE
|
|
|
|
/obj/projectile/magic/spellblade/on_hit(target)
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
qdel(src)
|
|
return BULLET_ACT_BLOCK
|
|
. = ..()
|
|
|
|
/obj/projectile/magic/arcane_barrage
|
|
name = "arcane bolt"
|
|
icon_state = "arcane_barrage"
|
|
damage = 20
|
|
damage_type = BURN
|
|
nodamage = FALSE
|
|
armour_penetration = 0
|
|
flag = MAGIC
|
|
hitsound = 'sound/weapons/barragespellhit.ogg'
|
|
|
|
/obj/projectile/magic/arcane_barrage/on_hit(target)
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
qdel(src)
|
|
return BULLET_ACT_BLOCK
|
|
. = ..()
|
|
|
|
|
|
/obj/projectile/magic/locker
|
|
name = "locker bolt"
|
|
icon_state = "locker"
|
|
nodamage = TRUE
|
|
flag = MAGIC
|
|
var/weld = TRUE
|
|
var/created = FALSE //prevents creation of more then one locker if it has multiple hits
|
|
var/locker_suck = TRUE
|
|
var/obj/structure/closet/locker_temp_instance = /obj/structure/closet/decay
|
|
|
|
/obj/projectile/magic/locker/Initialize()
|
|
. = ..()
|
|
locker_temp_instance = new(src)
|
|
|
|
/obj/projectile/magic/locker/prehit_pierce(atom/A)
|
|
. = ..()
|
|
if(isliving(A) && locker_suck)
|
|
var/mob/living/M = A
|
|
if(M.anti_magic_check()) // no this doesn't check if ..() returned to phase through do I care no it's magic ain't gotta explain shit
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [A]!</span>")
|
|
return PROJECTILE_DELETE_WITHOUT_HITTING
|
|
if(!locker_temp_instance.insertion_allowed(M))
|
|
return
|
|
M.forceMove(src)
|
|
return PROJECTILE_PIERCE_PHASE
|
|
|
|
/obj/projectile/magic/locker/on_hit(target)
|
|
if(created)
|
|
return ..()
|
|
if(LAZYLEN(contents))
|
|
for(var/atom/movable/AM in contents)
|
|
locker_temp_instance.insert(AM)
|
|
locker_temp_instance.welded = weld
|
|
locker_temp_instance.update_icon()
|
|
created = TRUE
|
|
return ..()
|
|
|
|
/obj/projectile/magic/locker/Destroy()
|
|
locker_suck = FALSE
|
|
for(var/atom/movable/AM in contents)
|
|
AM.forceMove(get_turf(src))
|
|
. = ..()
|
|
|
|
/obj/structure/closet/decay
|
|
breakout_time = 600
|
|
icon_welded = null
|
|
var/magic_icon = "cursed"
|
|
var/weakened_icon = "decursed"
|
|
var/auto_destroy = TRUE
|
|
|
|
/obj/structure/closet/decay/Initialize()
|
|
. = ..()
|
|
if(auto_destroy)
|
|
addtimer(CALLBACK(src, .proc/bust_open), 5 MINUTES)
|
|
addtimer(CALLBACK(src, .proc/magicly_lock), 5)
|
|
|
|
/obj/structure/closet/decay/proc/magicly_lock()
|
|
if(!welded)
|
|
return
|
|
icon_state = magic_icon
|
|
update_icon()
|
|
|
|
/obj/structure/closet/decay/after_weld(weld_state)
|
|
if(weld_state)
|
|
unmagify()
|
|
|
|
/obj/structure/closet/decay/proc/decay()
|
|
animate(src, alpha = 0, time = 30)
|
|
addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, src), 30)
|
|
|
|
/obj/structure/closet/decay/open(mob/living/user, force = FALSE)
|
|
. = ..()
|
|
if(.)
|
|
if(icon_state == magic_icon) //check if we used the magic icon at all before giving it the lesser magic icon
|
|
unmagify()
|
|
else
|
|
addtimer(CALLBACK(src, .proc/decay), 15 SECONDS)
|
|
|
|
/obj/structure/closet/decay/proc/unmagify()
|
|
icon_state = weakened_icon
|
|
update_icon()
|
|
addtimer(CALLBACK(src, .proc/decay), 15 SECONDS)
|
|
icon_welded = "welded"
|
|
|
|
/obj/projectile/magic/flying
|
|
name = "bolt of flying"
|
|
icon_state = "flight"
|
|
|
|
/obj/projectile/magic/flying/on_hit(target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
var/mob/living/L = target
|
|
if(L.anti_magic_check())
|
|
L.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
var/atom/throw_target = get_edge_target_turf(L, angle2dir(Angle))
|
|
L.throw_at(throw_target, 200, 4)
|
|
|
|
/obj/projectile/magic/bounty
|
|
name = "bolt of bounty"
|
|
icon_state = "bounty"
|
|
|
|
/obj/projectile/magic/bounty/on_hit(target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
var/mob/living/L = target
|
|
if(L.anti_magic_check() || !firer)
|
|
L.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
L.apply_status_effect(STATUS_EFFECT_BOUNTY, firer)
|
|
|
|
/obj/projectile/magic/antimagic
|
|
name = "bolt of antimagic"
|
|
icon_state = "antimagic"
|
|
|
|
/obj/projectile/magic/antimagic/on_hit(target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
var/mob/living/L = target
|
|
if(L.anti_magic_check())
|
|
L.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
L.apply_status_effect(STATUS_EFFECT_ANTIMAGIC)
|
|
|
|
/obj/projectile/magic/fetch
|
|
name = "bolt of fetching"
|
|
icon_state = "fetch"
|
|
|
|
/obj/projectile/magic/fetch/on_hit(target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
var/mob/living/L = target
|
|
if(L.anti_magic_check() || !firer)
|
|
L.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
var/atom/throw_target = get_edge_target_turf(L, get_dir(L, firer))
|
|
L.throw_at(throw_target, 200, 4)
|
|
|
|
/obj/projectile/magic/sapping
|
|
name = "bolt of sapping"
|
|
icon_state = "sapping"
|
|
|
|
/obj/projectile/magic/sapping/on_hit(target)
|
|
. = ..()
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/sapped)
|
|
|
|
/obj/projectile/magic/necropotence
|
|
name = "bolt of necropotence"
|
|
icon_state = "necropotence"
|
|
|
|
/obj/projectile/magic/necropotence/on_hit(target)
|
|
. = ..()
|
|
if(isliving(target))
|
|
var/mob/living/L = target
|
|
if(L.anti_magic_check() || !L.mind)
|
|
L.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
to_chat(L, "<span class='danger'>Your body feels drained and there is a burning pain in your chest.</span>")
|
|
L.maxHealth -= 20
|
|
L.health = min(L.health, L.maxHealth)
|
|
if(L.maxHealth <= 0)
|
|
to_chat(L, "<span class='userdanger'>Your weakened soul is completely consumed by the [src]!</span>")
|
|
return
|
|
for(var/obj/effect/proc_holder/spell/spell in L.mind.spell_list)
|
|
spell.charge_counter = spell.charge_max
|
|
spell.recharging = FALSE
|
|
spell.update_icon()
|
|
|
|
/obj/projectile/magic/wipe
|
|
name = "bolt of possession"
|
|
icon_state = "wipe"
|
|
|
|
/obj/projectile/magic/wipe/on_hit(target)
|
|
. = ..()
|
|
if(iscarbon(target))
|
|
var/mob/living/carbon/M = target
|
|
if(M.anti_magic_check())
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
for(var/x in M.get_traumas())//checks to see if the victim is already going through possession
|
|
if(istype(x, /datum/brain_trauma/special/imaginary_friend/trapped_owner))
|
|
M.visible_message("<span class='warning'>[src] vanishes on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
to_chat(M, "<span class='warning'>Your mind has been opened to possession!</span>")
|
|
possession_test(M)
|
|
return BULLET_ACT_HIT
|
|
|
|
/obj/projectile/magic/wipe/proc/possession_test(mob/living/carbon/M)
|
|
var/datum/brain_trauma/special/imaginary_friend/trapped_owner/trauma = M.gain_trauma(/datum/brain_trauma/special/imaginary_friend/trapped_owner)
|
|
var/poll_message = "Do you want to play as [M.real_name]?"
|
|
if(M.mind && M.mind.assigned_role)
|
|
poll_message = "[poll_message] Job:[M.mind.assigned_role]."
|
|
if(M.mind && M.mind.special_role)
|
|
poll_message = "[poll_message] Status:[M.mind.special_role]."
|
|
else if(M.mind)
|
|
var/datum/antagonist/A = M.mind.has_antag_datum(/datum/antagonist/)
|
|
if(A)
|
|
poll_message = "[poll_message] Status:[A.name]."
|
|
var/list/mob/dead/observer/candidates = pollCandidatesForMob(poll_message, ROLE_PAI, null, FALSE, 100, M)
|
|
if(M.stat == DEAD)//boo.
|
|
return
|
|
if(LAZYLEN(candidates))
|
|
var/mob/dead/observer/C = pick(candidates)
|
|
to_chat(M, "<span class='boldnotice'>You have been noticed by a ghost and it has possessed you!</span>")
|
|
var/oldkey = M.key
|
|
M.ghostize(0)
|
|
M.key = C.key
|
|
trauma.friend.key = oldkey
|
|
trauma.friend.reset_perspective(null)
|
|
trauma.friend.Show()
|
|
trauma.friend_initialized = TRUE
|
|
else
|
|
to_chat(M, "<span class='notice'>Your mind has managed to go unnoticed in the spirit world.</span>")
|
|
qdel(trauma)
|
|
|
|
/obj/projectile/magic/aoe
|
|
name = "Area Bolt"
|
|
desc = "What the fuck does this do?!"
|
|
damage = 0
|
|
var/proxdet = TRUE
|
|
|
|
/obj/projectile/magic/aoe/Range()
|
|
if(proxdet)
|
|
for(var/mob/living/L in range(1, get_turf(src)))
|
|
if(L.stat != DEAD && L != firer && !L.anti_magic_check())
|
|
return Bump(L)
|
|
..()
|
|
|
|
|
|
/obj/projectile/magic/aoe/lightning
|
|
name = "lightning bolt"
|
|
icon_state = "tesla_projectile" //Better sprites are REALLY needed and appreciated!~
|
|
damage = 15
|
|
damage_type = BURN
|
|
nodamage = FALSE
|
|
speed = 0.3
|
|
flag = MAGIC
|
|
|
|
var/zap_power = 20000
|
|
var/zap_range = 15
|
|
var/zap_flags = ZAP_MOB_DAMAGE | ZAP_MOB_STUN | ZAP_OBJ_DAMAGE
|
|
var/chain
|
|
var/mob/living/caster
|
|
|
|
/obj/projectile/magic/aoe/lightning/fire(setAngle)
|
|
if(caster)
|
|
chain = caster.Beam(src, icon_state = "lightning[rand(1, 12)]", time = INFINITY, maxdistance = INFINITY)
|
|
..()
|
|
|
|
/obj/projectile/magic/aoe/lightning/on_hit(target)
|
|
. = ..()
|
|
if(ismob(target))
|
|
var/mob/M = target
|
|
if(M.anti_magic_check())
|
|
visible_message("<span class='warning'>[src] fizzles on contact with [target]!</span>")
|
|
qdel(src)
|
|
return BULLET_ACT_BLOCK
|
|
tesla_zap(src, zap_range, zap_power, zap_flags)
|
|
qdel(src)
|
|
|
|
/obj/projectile/magic/aoe/lightning/no_zap
|
|
zap_power = 10000
|
|
zap_range = 4
|
|
zap_flags = ZAP_MOB_DAMAGE | ZAP_OBJ_DAMAGE
|
|
|
|
/obj/projectile/magic/aoe/lightning/Destroy()
|
|
qdel(chain)
|
|
. = ..()
|
|
|
|
/obj/projectile/magic/aoe/fireball
|
|
name = "bolt of fireball"
|
|
icon_state = "fireball"
|
|
damage = 10
|
|
damage_type = BRUTE
|
|
nodamage = FALSE
|
|
|
|
//explosion values
|
|
var/exp_heavy = 0
|
|
var/exp_light = 2
|
|
var/exp_flash = 3
|
|
var/exp_fire = 2
|
|
|
|
/obj/projectile/magic/aoe/fireball/on_hit(target)
|
|
. = ..()
|
|
if(ismob(target))
|
|
var/mob/living/M = target
|
|
if(M.anti_magic_check())
|
|
visible_message("<span class='warning'>[src] vanishes into smoke on contact with [target]!</span>")
|
|
return BULLET_ACT_BLOCK
|
|
M.take_overall_damage(0,10) //between this 10 burn, the 10 brute, the explosion brute, and the onfire burn, your at about 65 damage if you stop drop and roll immediately
|
|
var/turf/T = get_turf(target)
|
|
explosion(T, -1, exp_heavy, exp_light, exp_flash, 0, flame_range = exp_fire)
|
|
|
|
|
|
//still magic related, but a different path
|
|
|
|
/obj/projectile/temp/chill
|
|
name = "bolt of chills"
|
|
icon_state = "ice_2"
|
|
damage = 0
|
|
damage_type = BURN
|
|
nodamage = FALSE
|
|
armour_penetration = 100
|
|
temperature = -200 // Cools you down greatly per hit
|
|
flag = MAGIC
|
|
|
|
/obj/projectile/magic/nothing
|
|
name = "bolt of nothing"
|