mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-27 23:29:10 +01:00
Moar whitespace normalization [MDB IGNORE] (#7750)
Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
/*
|
||||
Aoe turf spells target a ring of tiles around the user
|
||||
This ring has an outer radius (range) and an inner radius (inner_radius)
|
||||
Aoe turf spells have two useful flags: IGNOREDENSE and IGNORESPACE. These are explained in setup.dm
|
||||
*/
|
||||
|
||||
/spell/aoe_turf //affects all turfs in view or range (depends)
|
||||
spell_flags = IGNOREDENSE
|
||||
var/inner_radius = -1 //for all your ring spell needs
|
||||
|
||||
/spell/aoe_turf/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
for(var/turf/target in view_or_range(range, holder, selection_type))
|
||||
if(!(target in view_or_range(inner_radius, holder, selection_type)))
|
||||
if(target.density && (spell_flags & IGNOREDENSE))
|
||||
continue
|
||||
if(istype(target, /turf/space) && (spell_flags & IGNORESPACE))
|
||||
continue
|
||||
targets += target
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
return
|
||||
|
||||
/*
|
||||
Aoe turf spells target a ring of tiles around the user
|
||||
This ring has an outer radius (range) and an inner radius (inner_radius)
|
||||
Aoe turf spells have two useful flags: IGNOREDENSE and IGNORESPACE. These are explained in setup.dm
|
||||
*/
|
||||
|
||||
/spell/aoe_turf //affects all turfs in view or range (depends)
|
||||
spell_flags = IGNOREDENSE
|
||||
var/inner_radius = -1 //for all your ring spell needs
|
||||
|
||||
/spell/aoe_turf/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
for(var/turf/target in view_or_range(range, holder, selection_type))
|
||||
if(!(target in view_or_range(inner_radius, holder, selection_type)))
|
||||
if(target.density && (spell_flags & IGNOREDENSE))
|
||||
continue
|
||||
if(istype(target, /turf/space) && (spell_flags & IGNORESPACE))
|
||||
continue
|
||||
targets += target
|
||||
|
||||
if(!targets.len) //doesn't waste the spell
|
||||
return
|
||||
|
||||
return targets
|
||||
@@ -1,25 +1,25 @@
|
||||
//////////////////////Scrying orb//////////////////////
|
||||
|
||||
/obj/item/weapon/scrying
|
||||
name = "scrying orb"
|
||||
desc = "An incandescent orb of otherworldly energy, staring into it gives you vision beyond mortal means."
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "bluespace"
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
throwforce = 10
|
||||
damtype = BURN
|
||||
force = 10
|
||||
hitsound = 'sound/items/welder2.ogg'
|
||||
|
||||
/obj/item/weapon/scrying/attack_self(mob/user as mob)
|
||||
if((user.mind && !wizards.is_antagonist(user.mind)))
|
||||
to_chat(user, "<span class='warning'>You stare into the orb and see nothing but your own reflection.</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='info'>You can see... everything!</span>")
|
||||
visible_message("<span class='danger'>[user] stares into [src], their eyes glazing over.</span>")
|
||||
|
||||
user.teleop = user.ghostize(1)
|
||||
announce_ghost_joinleave(user.teleop, 1, "You feel that they used a powerful artifact to [pick("invade","disturb","disrupt","infest","taint","spoil","blight")] this place with their presence.")
|
||||
return
|
||||
//////////////////////Scrying orb//////////////////////
|
||||
|
||||
/obj/item/weapon/scrying
|
||||
name = "scrying orb"
|
||||
desc = "An incandescent orb of otherworldly energy, staring into it gives you vision beyond mortal means."
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "bluespace"
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
throwforce = 10
|
||||
damtype = BURN
|
||||
force = 10
|
||||
hitsound = 'sound/items/welder2.ogg'
|
||||
|
||||
/obj/item/weapon/scrying/attack_self(mob/user as mob)
|
||||
if((user.mind && !wizards.is_antagonist(user.mind)))
|
||||
to_chat(user, "<span class='warning'>You stare into the orb and see nothing but your own reflection.</span>")
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='info'>You can see... everything!</span>")
|
||||
visible_message("<span class='danger'>[user] stares into [src], their eyes glazing over.</span>")
|
||||
|
||||
user.teleop = user.ghostize(1)
|
||||
announce_ghost_joinleave(user.teleop, 1, "You feel that they used a powerful artifact to [pick("invade","disturb","disrupt","infest","taint","spoil","blight")] this place with their presence.")
|
||||
return
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
/datum/mind
|
||||
var/list/learned_spells
|
||||
|
||||
/mob/Life()
|
||||
..()
|
||||
if(spell_masters && spell_masters.len)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.update_spells(0, src)
|
||||
|
||||
/mob/Login()
|
||||
..()
|
||||
if(spell_masters)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.toggle_open(1)
|
||||
client.screen -= spell_master
|
||||
|
||||
/mob/Stat()
|
||||
. = ..()
|
||||
if(. && spell_list && spell_list.len)
|
||||
for(var/spell/S in spell_list)
|
||||
if((!S.connected_button) || !statpanel(S.panel))
|
||||
continue //Not showing the noclothes spell
|
||||
switch(S.charge_type)
|
||||
if(Sp_RECHARGE)
|
||||
statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S.connected_button)
|
||||
if(Sp_CHARGES)
|
||||
statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S.connected_button)
|
||||
if(Sp_HOLDVAR)
|
||||
statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S.connected_button)
|
||||
|
||||
/hook/clone/proc/restore_spells(var/mob/H)
|
||||
if(H.mind && H.mind.learned_spells)
|
||||
for(var/spell/spell_to_add in H.mind.learned_spells)
|
||||
H.add_spell(spell_to_add)
|
||||
|
||||
/mob/proc/add_spell(var/spell/spell_to_add, var/spell_base = "wiz_spell_ready", var/master_type = /obj/screen/movable/spell_master)
|
||||
if(!spell_masters)
|
||||
spell_masters = list()
|
||||
|
||||
if(spell_masters.len)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
if(spell_master.type == master_type)
|
||||
spell_list.Add(spell_to_add)
|
||||
spell_master.add_spell(spell_to_add)
|
||||
return 1
|
||||
|
||||
var/obj/screen/movable/spell_master/new_spell_master = new master_type //we're here because either we didn't find our type, or we have no spell masters to attach to
|
||||
if(client)
|
||||
src.client.screen += new_spell_master
|
||||
new_spell_master.spell_holder = src
|
||||
new_spell_master.add_spell(spell_to_add)
|
||||
if(spell_base)
|
||||
new_spell_master.icon_state = spell_base
|
||||
spell_masters.Add(new_spell_master)
|
||||
spell_list.Add(spell_to_add)
|
||||
if(mind)
|
||||
if(!mind.learned_spells)
|
||||
mind.learned_spells = list()
|
||||
mind.learned_spells += spell_to_add
|
||||
|
||||
return 1
|
||||
|
||||
/mob/proc/remove_spell(var/spell/spell_to_remove)
|
||||
if(!spell_to_remove || !istype(spell_to_remove))
|
||||
return
|
||||
|
||||
if(!(spell_to_remove in spell_list))
|
||||
return
|
||||
|
||||
if(!spell_masters || !spell_masters.len)
|
||||
return
|
||||
|
||||
if(mind && mind.learned_spells)
|
||||
mind.learned_spells.Remove(spell_to_remove)
|
||||
spell_list.Remove(spell_to_remove)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.remove_spell(spell_to_remove)
|
||||
return 1
|
||||
|
||||
/mob/proc/silence_spells(var/amount = 0)
|
||||
if(!(amount >= 0))
|
||||
return
|
||||
|
||||
if(!spell_masters || !spell_masters.len)
|
||||
return
|
||||
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.silence_spells(amount)
|
||||
/datum/mind
|
||||
var/list/learned_spells
|
||||
|
||||
/mob/Life()
|
||||
..()
|
||||
if(spell_masters && spell_masters.len)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.update_spells(0, src)
|
||||
|
||||
/mob/Login()
|
||||
..()
|
||||
if(spell_masters)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.toggle_open(1)
|
||||
client.screen -= spell_master
|
||||
|
||||
/mob/Stat()
|
||||
. = ..()
|
||||
if(. && spell_list && spell_list.len)
|
||||
for(var/spell/S in spell_list)
|
||||
if((!S.connected_button) || !statpanel(S.panel))
|
||||
continue //Not showing the noclothes spell
|
||||
switch(S.charge_type)
|
||||
if(Sp_RECHARGE)
|
||||
statpanel(S.panel,"[S.charge_counter/10.0]/[S.charge_max/10]",S.connected_button)
|
||||
if(Sp_CHARGES)
|
||||
statpanel(S.panel,"[S.charge_counter]/[S.charge_max]",S.connected_button)
|
||||
if(Sp_HOLDVAR)
|
||||
statpanel(S.panel,"[S.holder_var_type] [S.holder_var_amount]",S.connected_button)
|
||||
|
||||
/hook/clone/proc/restore_spells(var/mob/H)
|
||||
if(H.mind && H.mind.learned_spells)
|
||||
for(var/spell/spell_to_add in H.mind.learned_spells)
|
||||
H.add_spell(spell_to_add)
|
||||
|
||||
/mob/proc/add_spell(var/spell/spell_to_add, var/spell_base = "wiz_spell_ready", var/master_type = /obj/screen/movable/spell_master)
|
||||
if(!spell_masters)
|
||||
spell_masters = list()
|
||||
|
||||
if(spell_masters.len)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
if(spell_master.type == master_type)
|
||||
spell_list.Add(spell_to_add)
|
||||
spell_master.add_spell(spell_to_add)
|
||||
return 1
|
||||
|
||||
var/obj/screen/movable/spell_master/new_spell_master = new master_type //we're here because either we didn't find our type, or we have no spell masters to attach to
|
||||
if(client)
|
||||
src.client.screen += new_spell_master
|
||||
new_spell_master.spell_holder = src
|
||||
new_spell_master.add_spell(spell_to_add)
|
||||
if(spell_base)
|
||||
new_spell_master.icon_state = spell_base
|
||||
spell_masters.Add(new_spell_master)
|
||||
spell_list.Add(spell_to_add)
|
||||
if(mind)
|
||||
if(!mind.learned_spells)
|
||||
mind.learned_spells = list()
|
||||
mind.learned_spells += spell_to_add
|
||||
|
||||
return 1
|
||||
|
||||
/mob/proc/remove_spell(var/spell/spell_to_remove)
|
||||
if(!spell_to_remove || !istype(spell_to_remove))
|
||||
return
|
||||
|
||||
if(!(spell_to_remove in spell_list))
|
||||
return
|
||||
|
||||
if(!spell_masters || !spell_masters.len)
|
||||
return
|
||||
|
||||
if(mind && mind.learned_spells)
|
||||
mind.learned_spells.Remove(spell_to_remove)
|
||||
spell_list.Remove(spell_to_remove)
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.remove_spell(spell_to_remove)
|
||||
return 1
|
||||
|
||||
/mob/proc/silence_spells(var/amount = 0)
|
||||
if(!(amount >= 0))
|
||||
return
|
||||
|
||||
if(!spell_masters || !spell_masters.len)
|
||||
return
|
||||
|
||||
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
|
||||
spell_master.silence_spells(amount)
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
//You can set duration to 0 to have the items last forever
|
||||
|
||||
/spell/targeted/equip_item
|
||||
name = "equipment spell"
|
||||
|
||||
var/list/equipped_summons = list() //assoc list of text ids and paths to spawn
|
||||
|
||||
var/list/summoned_items = list() //list of items we summoned and will dispose when the spell runs out
|
||||
|
||||
var/delete_old = 1 //if the item previously in the slot is deleted - otherwise, it's dropped
|
||||
|
||||
/spell/targeted/equip_item/cast(list/targets, mob/user = usr)
|
||||
..()
|
||||
for(var/mob/living/L in targets)
|
||||
for(var/slot_id in equipped_summons)
|
||||
var/to_create = equipped_summons[slot_id]
|
||||
slot_id = text2num(slot_id) //because the index is text, we access this instead
|
||||
var/obj/item/new_item = summon_item(to_create)
|
||||
var/obj/item/old_item = L.get_equipped_item(slot_id)
|
||||
L.equip_to_slot(new_item, slot_id)
|
||||
if(old_item)
|
||||
L.remove_from_mob(old_item)
|
||||
if(delete_old)
|
||||
qdel(old_item)
|
||||
else
|
||||
old_item.loc = L.loc
|
||||
|
||||
if(duration)
|
||||
summoned_items += new_item //we store it in a list to remove later
|
||||
|
||||
if(duration)
|
||||
spawn(duration)
|
||||
for(var/obj/item/to_remove in summoned_items)
|
||||
if(istype(to_remove.loc, /mob))
|
||||
var/mob/M = to_remove.loc
|
||||
M.remove_from_mob(to_remove)
|
||||
qdel(to_remove)
|
||||
|
||||
/spell/targeted/equip_item/proc/summon_item(var/newtype)
|
||||
return new newtype
|
||||
//You can set duration to 0 to have the items last forever
|
||||
|
||||
/spell/targeted/equip_item
|
||||
name = "equipment spell"
|
||||
|
||||
var/list/equipped_summons = list() //assoc list of text ids and paths to spawn
|
||||
|
||||
var/list/summoned_items = list() //list of items we summoned and will dispose when the spell runs out
|
||||
|
||||
var/delete_old = 1 //if the item previously in the slot is deleted - otherwise, it's dropped
|
||||
|
||||
/spell/targeted/equip_item/cast(list/targets, mob/user = usr)
|
||||
..()
|
||||
for(var/mob/living/L in targets)
|
||||
for(var/slot_id in equipped_summons)
|
||||
var/to_create = equipped_summons[slot_id]
|
||||
slot_id = text2num(slot_id) //because the index is text, we access this instead
|
||||
var/obj/item/new_item = summon_item(to_create)
|
||||
var/obj/item/old_item = L.get_equipped_item(slot_id)
|
||||
L.equip_to_slot(new_item, slot_id)
|
||||
if(old_item)
|
||||
L.remove_from_mob(old_item)
|
||||
if(delete_old)
|
||||
qdel(old_item)
|
||||
else
|
||||
old_item.loc = L.loc
|
||||
|
||||
if(duration)
|
||||
summoned_items += new_item //we store it in a list to remove later
|
||||
|
||||
if(duration)
|
||||
spawn(duration)
|
||||
for(var/obj/item/to_remove in summoned_items)
|
||||
if(istype(to_remove.loc, /mob))
|
||||
var/mob/M = to_remove.loc
|
||||
M.remove_from_mob(to_remove)
|
||||
qdel(to_remove)
|
||||
|
||||
/spell/targeted/equip_item/proc/summon_item(var/newtype)
|
||||
return new newtype
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
/spell/targeted/equip_item/horsemask
|
||||
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 = Sp_RECHARGE
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
spell_flags = 0
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = SpI_SHOUT
|
||||
range = 7
|
||||
max_targets = 1
|
||||
cooldown_min = 30 //30 deciseconds reduction per rank
|
||||
selection_type = "range"
|
||||
|
||||
compatible_mobs = list(/mob/living/carbon/human)
|
||||
|
||||
hud_state = "wiz_horse"
|
||||
|
||||
/spell/targeted/equip_item/horsemask/New()
|
||||
..()
|
||||
equipped_summons = list("[slot_wear_mask]" = /obj/item/clothing/mask/horsehead)
|
||||
|
||||
/spell/targeted/equip_item/horsemask/cast(list/targets, mob/user = usr)
|
||||
..()
|
||||
for(var/mob/living/target in targets)
|
||||
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
|
||||
target.flash_eyes()
|
||||
|
||||
/spell/targeted/equip_item/horsemask/summon_item(var/new_type)
|
||||
var/obj/item/new_item = new new_type
|
||||
new_item.canremove = FALSE //curses!
|
||||
new_item.unacidable = TRUE
|
||||
if(istype(new_item, /obj/item/clothing/mask/horsehead))
|
||||
var/obj/item/clothing/mask/horsehead/magichead = new_item
|
||||
magichead.flags_inv = null //so you can still see their face
|
||||
magichead.voicechange = 1 //NEEEEIIGHH
|
||||
return new_item
|
||||
/spell/targeted/equip_item/horsemask
|
||||
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 = Sp_RECHARGE
|
||||
charge_max = 150
|
||||
charge_counter = 0
|
||||
spell_flags = 0
|
||||
invocation = "KN'A FTAGHU, PUCK 'BTHNK!"
|
||||
invocation_type = SpI_SHOUT
|
||||
range = 7
|
||||
max_targets = 1
|
||||
cooldown_min = 30 //30 deciseconds reduction per rank
|
||||
selection_type = "range"
|
||||
|
||||
compatible_mobs = list(/mob/living/carbon/human)
|
||||
|
||||
hud_state = "wiz_horse"
|
||||
|
||||
/spell/targeted/equip_item/horsemask/New()
|
||||
..()
|
||||
equipped_summons = list("[slot_wear_mask]" = /obj/item/clothing/mask/horsehead)
|
||||
|
||||
/spell/targeted/equip_item/horsemask/cast(list/targets, mob/user = usr)
|
||||
..()
|
||||
for(var/mob/living/target in targets)
|
||||
target.visible_message( "<span class='danger'>[target]'s face lights up in fire, and after the event a horse's head takes its place!</span>", \
|
||||
"<span class='danger'>Your face burns up, and shortly after the fire you realise you have the face of a horse!</span>")
|
||||
target.flash_eyes()
|
||||
|
||||
/spell/targeted/equip_item/horsemask/summon_item(var/new_type)
|
||||
var/obj/item/new_item = new new_type
|
||||
new_item.canremove = FALSE //curses!
|
||||
new_item.unacidable = TRUE
|
||||
if(istype(new_item, /obj/item/clothing/mask/horsehead))
|
||||
var/obj/item/clothing/mask/horsehead/magichead = new_item
|
||||
magichead.flags_inv = null //so you can still see their face
|
||||
magichead.voicechange = 1 //NEEEEIIGHH
|
||||
return new_item
|
||||
|
||||
@@ -1,145 +1,145 @@
|
||||
/*
|
||||
Targeted spells (with the exception of dumbfire) select from all the mobs in the defined range
|
||||
Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are explained in setup.dm
|
||||
*/
|
||||
|
||||
|
||||
/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
|
||||
var/max_targets = 1 //leave 0 for unlimited targets in range, more for limited number of casts (can all target one guy, depends on target_ignore_prev) in range
|
||||
var/target_ignore_prev = 1 //only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
|
||||
|
||||
|
||||
var/amt_weakened = 0
|
||||
var/amt_paralysis = 0
|
||||
var/amt_stunned = 0
|
||||
|
||||
var/amt_dizziness = 0
|
||||
var/amt_confused = 0
|
||||
var/amt_stuttering = 0
|
||||
|
||||
//set to negatives for healing
|
||||
var/amt_dam_fire = 0
|
||||
var/amt_dam_brute = 0
|
||||
var/amt_dam_oxy = 0
|
||||
var/amt_dam_tox = 0
|
||||
|
||||
var/amt_eye_blind = 0
|
||||
var/amt_eye_blurry = 0
|
||||
|
||||
var/list/compatible_mobs = list()
|
||||
|
||||
|
||||
/spell/targeted/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
if(max_targets == 0) //unlimited
|
||||
if(range == -2)
|
||||
targets = living_mob_list
|
||||
else
|
||||
for(var/mob/living/target in view_or_range(range, holder, selection_type))
|
||||
targets += target
|
||||
|
||||
else if(max_targets == 1) //single target can be picked
|
||||
if((range == 0 || range == -1) && spell_flags & INCLUDEUSER)
|
||||
targets += user
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
var/list/starting_targets
|
||||
if(range == -2)
|
||||
starting_targets = living_mob_list
|
||||
else
|
||||
starting_targets = view_or_range(range, holder, selection_type)
|
||||
|
||||
for(var/mob/living/M in starting_targets)
|
||||
if(!(spell_flags & INCLUDEUSER) && M == user)
|
||||
continue
|
||||
if(compatible_mobs && compatible_mobs.len)
|
||||
if(!is_type_in_list(M, compatible_mobs)) continue
|
||||
if(compatible_mobs && compatible_mobs.len && !is_type_in_list(M, compatible_mobs))
|
||||
continue
|
||||
possible_targets += M
|
||||
|
||||
if(possible_targets.len)
|
||||
if(spell_flags & SELECTABLE) //if we are allowed to choose. see setup.dm for details
|
||||
var/mob/temp_target = tgui_input_list(user, "Choose the target for the spell.", "Targeting", possible_targets)
|
||||
if(temp_target)
|
||||
targets += temp_target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
//Adds a safety check post-input to make sure those targets are actually in range.
|
||||
|
||||
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
var/list/starting_targets
|
||||
|
||||
if(range == -2)
|
||||
starting_targets = living_mob_list
|
||||
else
|
||||
starting_targets = view_or_range(range, holder, selection_type)
|
||||
|
||||
for(var/mob/living/target in starting_targets)
|
||||
if(!(spell_flags & INCLUDEUSER) && target == user)
|
||||
continue
|
||||
if(compatible_mobs && !is_type_in_list(target, compatible_mobs))
|
||||
continue
|
||||
possible_targets += target
|
||||
|
||||
if(spell_flags & SELECTABLE)
|
||||
for(var/i = 1; i<=max_targets, i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
var/mob/M = tgui_input_list(user, "Choose the target for the spell.", "Targeting", possible_targets)
|
||||
if(!M)
|
||||
break
|
||||
if(range != -2)
|
||||
if(!(M in view_or_range(range, holder, selection_type)))
|
||||
continue
|
||||
targets += M
|
||||
possible_targets -= M
|
||||
else
|
||||
for(var/i=1,i<=max_targets,i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
if(target_ignore_prev)
|
||||
var/target = pick(possible_targets)
|
||||
possible_targets -= target
|
||||
targets += target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
|
||||
if(!(spell_flags & INCLUDEUSER) && (user in targets))
|
||||
targets -= user
|
||||
|
||||
if(compatible_mobs && compatible_mobs.len)
|
||||
for(var/mob/living/target in targets) //filters out all the non-compatible mobs
|
||||
if(!is_type_in_list(target, compatible_mobs))
|
||||
targets -= target
|
||||
|
||||
return targets
|
||||
|
||||
/spell/targeted/cast(var/list/targets, mob/user)
|
||||
for(var/mob/living/target in targets)
|
||||
if(range >= 0)
|
||||
if(!(target in view_or_range(range, holder, selection_type))) //filter at time of casting
|
||||
targets -= target
|
||||
continue
|
||||
apply_spell_damage(target)
|
||||
|
||||
/spell/targeted/proc/apply_spell_damage(mob/living/target)
|
||||
target.adjustBruteLoss(amt_dam_brute)
|
||||
target.adjustFireLoss(amt_dam_fire)
|
||||
target.adjustToxLoss(amt_dam_tox)
|
||||
target.adjustOxyLoss(amt_dam_oxy)
|
||||
//disabling
|
||||
target.Weaken(amt_weakened)
|
||||
target.Paralyse(amt_paralysis)
|
||||
target.Stun(amt_stunned)
|
||||
if(amt_weakened || amt_paralysis || amt_stunned)
|
||||
if(target.buckled)
|
||||
target.buckled = null
|
||||
target.Blind(amt_eye_blind)
|
||||
target.eye_blurry += amt_eye_blurry
|
||||
target.dizziness += amt_dizziness
|
||||
target.Confuse(amt_confused)
|
||||
/*
|
||||
Targeted spells (with the exception of dumbfire) select from all the mobs in the defined range
|
||||
Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are explained in setup.dm
|
||||
*/
|
||||
|
||||
|
||||
/spell/targeted //can mean aoe for mobs (limited/unlimited number) or one target mob
|
||||
var/max_targets = 1 //leave 0 for unlimited targets in range, more for limited number of casts (can all target one guy, depends on target_ignore_prev) in range
|
||||
var/target_ignore_prev = 1 //only important if max_targets > 1, affects if the spell can be cast multiple times at one person from one cast
|
||||
|
||||
|
||||
var/amt_weakened = 0
|
||||
var/amt_paralysis = 0
|
||||
var/amt_stunned = 0
|
||||
|
||||
var/amt_dizziness = 0
|
||||
var/amt_confused = 0
|
||||
var/amt_stuttering = 0
|
||||
|
||||
//set to negatives for healing
|
||||
var/amt_dam_fire = 0
|
||||
var/amt_dam_brute = 0
|
||||
var/amt_dam_oxy = 0
|
||||
var/amt_dam_tox = 0
|
||||
|
||||
var/amt_eye_blind = 0
|
||||
var/amt_eye_blurry = 0
|
||||
|
||||
var/list/compatible_mobs = list()
|
||||
|
||||
|
||||
/spell/targeted/choose_targets(mob/user = usr)
|
||||
var/list/targets = list()
|
||||
|
||||
if(max_targets == 0) //unlimited
|
||||
if(range == -2)
|
||||
targets = living_mob_list
|
||||
else
|
||||
for(var/mob/living/target in view_or_range(range, holder, selection_type))
|
||||
targets += target
|
||||
|
||||
else if(max_targets == 1) //single target can be picked
|
||||
if((range == 0 || range == -1) && spell_flags & INCLUDEUSER)
|
||||
targets += user
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
var/list/starting_targets
|
||||
if(range == -2)
|
||||
starting_targets = living_mob_list
|
||||
else
|
||||
starting_targets = view_or_range(range, holder, selection_type)
|
||||
|
||||
for(var/mob/living/M in starting_targets)
|
||||
if(!(spell_flags & INCLUDEUSER) && M == user)
|
||||
continue
|
||||
if(compatible_mobs && compatible_mobs.len)
|
||||
if(!is_type_in_list(M, compatible_mobs)) continue
|
||||
if(compatible_mobs && compatible_mobs.len && !is_type_in_list(M, compatible_mobs))
|
||||
continue
|
||||
possible_targets += M
|
||||
|
||||
if(possible_targets.len)
|
||||
if(spell_flags & SELECTABLE) //if we are allowed to choose. see setup.dm for details
|
||||
var/mob/temp_target = tgui_input_list(user, "Choose the target for the spell.", "Targeting", possible_targets)
|
||||
if(temp_target)
|
||||
targets += temp_target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
//Adds a safety check post-input to make sure those targets are actually in range.
|
||||
|
||||
|
||||
else
|
||||
var/list/possible_targets = list()
|
||||
var/list/starting_targets
|
||||
|
||||
if(range == -2)
|
||||
starting_targets = living_mob_list
|
||||
else
|
||||
starting_targets = view_or_range(range, holder, selection_type)
|
||||
|
||||
for(var/mob/living/target in starting_targets)
|
||||
if(!(spell_flags & INCLUDEUSER) && target == user)
|
||||
continue
|
||||
if(compatible_mobs && !is_type_in_list(target, compatible_mobs))
|
||||
continue
|
||||
possible_targets += target
|
||||
|
||||
if(spell_flags & SELECTABLE)
|
||||
for(var/i = 1; i<=max_targets, i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
var/mob/M = tgui_input_list(user, "Choose the target for the spell.", "Targeting", possible_targets)
|
||||
if(!M)
|
||||
break
|
||||
if(range != -2)
|
||||
if(!(M in view_or_range(range, holder, selection_type)))
|
||||
continue
|
||||
targets += M
|
||||
possible_targets -= M
|
||||
else
|
||||
for(var/i=1,i<=max_targets,i++)
|
||||
if(!possible_targets.len)
|
||||
break
|
||||
if(target_ignore_prev)
|
||||
var/target = pick(possible_targets)
|
||||
possible_targets -= target
|
||||
targets += target
|
||||
else
|
||||
targets += pick(possible_targets)
|
||||
|
||||
if(!(spell_flags & INCLUDEUSER) && (user in targets))
|
||||
targets -= user
|
||||
|
||||
if(compatible_mobs && compatible_mobs.len)
|
||||
for(var/mob/living/target in targets) //filters out all the non-compatible mobs
|
||||
if(!is_type_in_list(target, compatible_mobs))
|
||||
targets -= target
|
||||
|
||||
return targets
|
||||
|
||||
/spell/targeted/cast(var/list/targets, mob/user)
|
||||
for(var/mob/living/target in targets)
|
||||
if(range >= 0)
|
||||
if(!(target in view_or_range(range, holder, selection_type))) //filter at time of casting
|
||||
targets -= target
|
||||
continue
|
||||
apply_spell_damage(target)
|
||||
|
||||
/spell/targeted/proc/apply_spell_damage(mob/living/target)
|
||||
target.adjustBruteLoss(amt_dam_brute)
|
||||
target.adjustFireLoss(amt_dam_fire)
|
||||
target.adjustToxLoss(amt_dam_tox)
|
||||
target.adjustOxyLoss(amt_dam_oxy)
|
||||
//disabling
|
||||
target.Weaken(amt_weakened)
|
||||
target.Paralyse(amt_paralysis)
|
||||
target.Stun(amt_stunned)
|
||||
if(amt_weakened || amt_paralysis || amt_stunned)
|
||||
if(target.buckled)
|
||||
target.buckled = null
|
||||
target.Blind(amt_eye_blind)
|
||||
target.eye_blurry += amt_eye_blurry
|
||||
target.dizziness += amt_dizziness
|
||||
target.Confuse(amt_confused)
|
||||
target.stuttering += amt_stuttering
|
||||
Reference in New Issue
Block a user