Magical fixes.

The wizard den is no longer pitch black.
Fixes targeted spells using the wrong caster/source.
Adds some missing checks using the caster source above.
Re-logging should no longer cause a loss of spell UI icons.
Mind transfer should no longer cause unintended spell loss.
This commit is contained in:
PsiOmegaDelta
2015-07-02 09:58:23 +02:00
parent bfe21b66c6
commit 616b4b60e4
12 changed files with 351 additions and 268 deletions

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
@@ -53,6 +52,8 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
var/hud_state = "" //name of the icon used in generating the spell hud object
var/override_base = ""
var/obj/screen/connected_button
///////////////////////
///SETUP AND PROCESS///
///////////////////////
@@ -69,11 +70,6 @@ var/list/spells = typesof(/spell) //needed for the badmin verb for now
sleep(1)
return
/spell/Click()
..()
perform(usr)
/////////////////
/////CASTING/////
/////////////////
@@ -182,18 +178,18 @@ 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
var/turf/Turf = get_turf(user)
if(!Turf)
user << "<span class='warning'>You cannot cast spells in null space!</span>"
if(spell_flags & Z2NOCAST && (Turf.z in config.admin_levels)) //Certain spells are not allowed on the centcomm zlevel
var/turf/user_turf = get_turf(user)
if(!user_turf)
user << "<span class='warning'>You cannot cast spells in null space!</span>"
if(spell_flags & Z2NOCAST && (user_turf.z in config.admin_levels)) //Certain spells are not allowed on the centcomm zlevel
return 0
if(spell_flags & CONSTRUCT_CHECK)
@@ -201,7 +197,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>"
@@ -210,7 +206,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
@@ -221,7 +217,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