Merge pull request #4719 from ComicIronic/EquipSpells

Moves some spells to a new equipping type
This commit is contained in:
d3athrow
2015-05-30 11:31:22 -05:00
12 changed files with 159 additions and 126 deletions

View File

@@ -11,8 +11,8 @@ Aoe turf spells have two useful flags: IGNOREDENSE and IGNORESPACE. These are ex
/spell/aoe_turf/choose_targets(mob/user = usr)
var/list/targets = list()
for(var/turf/target in view_or_range(range,user,selection_type))
if(!(target in view_or_range(inner_radius,user,selection_type)))
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))

View File

@@ -1,9 +1,9 @@
var/list/spells = typesof(/spell) //needed for the badmin verb for now
/spell
name = "Spell"
desc = "A spell"
parent_type = /atom/movable
var/name = "Spell"
var/desc = "A spell"
parent_type = /datum
var/panel = "Spells"//What panel the proc holder needs to go on.
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?
@@ -25,8 +25,7 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
var/range = 7 //the range of the spell; outer radius for aoe spells
var/message = "" //whatever it says to the guy affected by it
var/selection_type = "view" //can be "range" or "view"
var/atom/movable/holder //where the spell is. Normally the user, can be a projectile
var/atom/movable/holder //where the spell is. Normally the user, can be an item
var/duration = 0 //how long the spell lasts
var/list/spell_levels = list(Sp_SPEED = 0, Sp_POWER = 0) //the current spell levels - total spell levels can be obtained by just adding the two values
@@ -69,11 +68,6 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
sleep(1)
return
/spell/Click()
..()
perform(usr)
/////////////////
/////CASTING/////
/////////////////
@@ -182,14 +176,14 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
if(!(src in user.spell_list))
if(!(src in user.spell_list) && holder == user)
user << "<span class='warning'>You shouldn't have this spell! Something's wrong.</span>"
return 0
if(silenced > 0)
return
if(user.z == 2 && spell_flags & Z2NOCAST) //Certain spells are not allowed on the centcomm zlevel
if(istype(map.zLevels[user.z], /datum/zLevel/centcomm) && spell_flags & Z2NOCAST) //Certain spells are not allowed on the centcomm zlevel
return 0
if(spell_flags & CONSTRUCT_CHECK)
@@ -197,7 +191,7 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
if(findNullRod(T))
return 0
if(istype(user, /mob/living/simple_animal))
if(istype(user, /mob/living/simple_animal) && holder == user)
var/mob/living/simple_animal/SA = user
if(SA.purge)
SA << "<span class='warning'>The nullrod's power interferes with your own!</span>"
@@ -206,7 +200,7 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
if(!src.check_charge(skipcharge, user)) //sees if we can cast based on charges alone
return 0
if(!(spell_flags & GHOSTCAST))
if(!(spell_flags & GHOSTCAST) && holder == user)
if(user.stat && !(spell_flags & STATALLOWED))
usr << "Not when you're incapacitated."
return 0
@@ -217,7 +211,7 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
return 0
var/spell/noclothes/spell = locate() in user.spell_list
if((spell_flags & NEEDSCLOTHES) && !(spell && istype(spell)))//clothes check
if((spell_flags & NEEDSCLOTHES) && !(spell && istype(spell)) && holder == user)//clothes check
if(!user.wearing_wiz_garb())
return 0

View File

@@ -1,46 +0,0 @@
/spell/targeted/genetic/clowncurse
name = "The Clown Curse"
desc = "A curse that will turn its victim into a miserable clown."
school = "evocation"
charge_max = 300
spell_flags = 0
invocation = "L' C'MMEDIA E F'NITA!"
invocation_type = SpI_SHOUT
range = 1
cooldown_min = 50
sparks_spread = 1
sparks_amt = 4
compatible_mobs = list(/mob/living/carbon/human)
hud_state = "wiz_clown"
/spell/targeted/genetic/clowncurse/cast(list/targets, mob/user = usr)
..()
for(var/mob/living/carbon/human/target in targets)
if(!ishuman(target)) continue
var/obj/item/clothing/mask/gas/clown_hat/magicclownmask = new /obj/item/clothing/mask/gas/clown_hat(target)
var/obj/item/clothing/under/rank/clown/magicclownunder = new /obj/item/clothing/under/rank/clown(target)
var/obj/item/clothing/shoes/clown_shoes/magicclownshoes = new /obj/item/clothing/shoes/clown_shoes(target)
magicclownmask.canremove = 0 //curses!
magicclownunder.canremove = 0
magicclownshoes.canremove = 0
magicclownmask.unacidable = 1 //cannot be acided
magicclownunder.unacidable = 1
magicclownshoes.unacidable = 1
magicclownmask.can_flip = 0 //no pushing the mask up off your face
var/obj/old_mask = target.wear_mask
var/obj/old_uniform = target.w_uniform
var /obj/old_shoes = target.shoes
target.equip_to_slot(magicclownmask, slot_wear_mask)
target.equip_to_slot(magicclownunder, slot_w_uniform)
target.equip_to_slot(magicclownshoes, slot_shoes)
qdel(old_mask)
qdel(old_uniform)
qdel(old_shoes)
flick("e_flash", target.flash)
target.dna.SetSEState(CLUMSYBLOCK,1)
genemutcheck(target,CLUMSYBLOCK,null,MUTCHK_FORCED)
target.update_mutations()

View File

@@ -0,0 +1,41 @@
/spell/targeted/equip_item/clowncurse
name = "The Clown Curse"
desc = "A curse that will turn its victim into a miserable clown."
school = "evocation"
charge_max = 300
spell_flags = 0
invocation = "L' C'MMEDIA E F'NITA!"
invocation_type = SpI_SHOUT
range = 1
cooldown_min = 50
sparks_spread = 1
sparks_amt = 4
compatible_mobs = list(/mob/living/carbon/human)
hud_state = "wiz_clown"
/spell/targeted/equip_item/clowncurse/New()
..()
equipped_summons = list("[slot_wear_mask]" = /obj/item/clothing/mask/gas/clown_hat,
"[slot_w_uniform]" = /obj/item/clothing/under/rank/clown,
"[slot_shoes]" = /obj/item/clothing/shoes/clown_shoes)
/spell/targeted/equip_item/clowncurse/cast(list/targets, mob/user = usr)
..()
for(var/mob/living/carbon/human/target in targets)
flick("e_flash", target.flash)
target.dna.SetSEState(CLUMSYBLOCK,1)
genemutcheck(target,CLUMSYBLOCK,null,MUTCHK_FORCED)
target.update_mutations()
/spell/targeted/equip_item/clowncurse/summon_item(var/newtype)
var/obj/item/new_item = new newtype
new_item.unacidable = 1
new_item.canremove = 0
if(istype(new_item, /obj/item/clothing/mask))
var/obj/item/clothing/mask/M = new_item
M.can_flip = 0
return new_item

View File

@@ -0,0 +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_item_by_slot(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

View File

@@ -0,0 +1,38 @@
/spell/targeted/equip_item/frenchcurse
name = "French Curse"
desc = "This curse will silence your target for a very long time."
school = "evocation"
charge_max = 300
spell_flags = 0
invocation = "FU'K Y'U D'NY"
invocation_type = SpI_SHOUT
range = 1
cooldown_min = 50
sparks_spread = 1
sparks_amt = 4
compatible_mobs = list(/mob/living/carbon/human)
hud_state = "wiz_mime"
/spell/targeted/equip_item/frenchcurse/New()
..()
equipped_summons = list("[slot_wear_mask]" = /obj/item/clothing/mask/gas/mime,
"[slot_w_uniform]" = /obj/item/clothing/under/mime)
/spell/targeted/equip_item/frenchcurse/cast(list/targets, mob/user = usr)
..()
for(var/mob/living/carbon/human/target in targets)
flick("e_flash", target.flash)
/spell/targeted/equip_item/frenchcurse/summon_item(var/newtype)
var/obj/item/new_item = new newtype
new_item.unacidable = 1
new_item.canremove = 0
if(istype(new_item, /obj/item/clothing/mask/gas/mime))
var/obj/item/clothing/mask/gas/mime/M = new_item
M.can_flip = 0
M.muted = 1
return new_item

View File

@@ -1,4 +1,4 @@
/spell/targeted/horsemask
/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"
@@ -17,19 +17,22 @@
hud_state = "wiz_horse"
/spell/targeted/horsemask/cast(list/targets, mob/user = usr)
/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)
var/obj/item/clothing/mask/horsehead/magichead = new /obj/item/clothing/mask/horsehead
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>")
flick("e_flash", target.flash)
/spell/targeted/equip_item/horsemask/summon_item(var/new_type)
var/obj/item/new_item = new new_type
if(istype(new_item, /obj/item/clothing/mask/horsehead))
var/obj/item/clothing/mask/horsehead/magichead = new_item
magichead.canremove = 0 //curses!
magichead.flags_inv = null //so you can still see their face
magichead.voicechange = 1 //NEEEEIIGHH
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>")
var/obj/old_mask = target.wear_mask
if(old_mask)
target.drop_from_inventory(old_mask)
qdel(old_mask) //get rid of this shit
target.equip_to_slot_if_possible(magichead, slot_wear_mask, 1, 1)
flick("e_flash", target.flash)
return new_item

View File

@@ -1,38 +0,0 @@
/spell/targeted/frenchcurse
name = "French Curse"
desc = "This curse will silence your target for a very long time."
school = "evocation"
charge_max = 300
spell_flags = 0
invocation = "FU'K Y'U D'NY"
invocation_type = SpI_SHOUT
range = 1
cooldown_min = 50
sparks_spread = 1
sparks_amt = 4
compatible_mobs = list(/mob/living/carbon/human)
hud_state = "wiz_mime"
/spell/targeted/frenchcurse/cast(list/targets, mob/user = usr)
..()
for(var/mob/living/carbon/human/target in targets)
if(!ishuman(target)) continue
var/obj/item/clothing/mask/gas/mime/magicmimemask = new /obj/item/clothing/mask/gas/mime(target)
var/obj/item/clothing/under/mime/magicmimeunder = new /obj/item/clothing/under/mime(target)
magicmimemask.canremove = 0 //curses!
magicmimeunder.canremove = 0
magicmimemask.unacidable = 1 //cannot be acided
magicmimeunder.unacidable = 1
magicmimemask.muted = 1 //silence
magicmimemask.can_flip = 0 //no pushing the mask up off your face
var/obj/old_mask = target.wear_mask
var/obj/old_uniform = target.w_uniform
target.equip_to_slot(magicmimemask, slot_wear_mask)
target.equip_to_slot(magicmimeunder, slot_w_uniform)
del(old_mask)
del(old_uniform)
flick("e_flash", target.flash)

View File

@@ -36,7 +36,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
if(range == -2)
targets = living_mob_list
else
for(var/mob/living/target in view_or_range(range, user, selection_type))
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
@@ -48,7 +48,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
if(range == -2)
starting_targets = living_mob_list
else
starting_targets = view_or_range(range, user, selection_type)
starting_targets = view_or_range(range, holder, selection_type)
for(var/mob/living/M in starting_targets)
if(!(spell_flags & INCLUDEUSER) && M == user)
@@ -76,7 +76,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
if(range == -2)
starting_targets = living_mob_list
else
starting_targets = view_or_range(range, user, selection_type)
starting_targets = view_or_range(range, holder, selection_type)
for(var/mob/living/target in starting_targets)
if(!(spell_flags & INCLUDEUSER) && target == user)
@@ -93,7 +93,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
if(!M)
break
if(range != -2)
if(!(M in view_or_range(range, user, selection_type)))
if(!(M in view_or_range(range, holder, selection_type)))
continue
targets += M
possible_targets -= M
@@ -121,7 +121,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
/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, user, selection_type))) //filter at time of casting
if(!(target in view_or_range(range, holder, selection_type))) //filter at time of casting
targets -= target
continue
apply_spell_damage(target)