Add shapeshift spell, human_req/nonabstract_req support and make Ashdrake reward a shapeshift.

This commit is contained in:
Markolie
2017-01-06 17:02:38 +01:00
parent f4c4bfe288
commit e2c60c2bdb
11 changed files with 119 additions and 24 deletions
+23 -17
View File
@@ -70,6 +70,8 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/ghost = 0 // Skip life check.
var/clothes_req = 1 //see if it requires clothes
var/human_req = 0 //spell can only be cast by humans
var/nonabstract_req = 0 //spell can only be cast by mobs that are physical entities
var/stat_allowed = 0 //see if it requires being conscious/alive, need to set to 1 for ghostpells
var/invocation = "HURP DURP" //what is uttered when the wizard casts the spell
var/invocation_emote_self = null
@@ -102,11 +104,11 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/sound = null //The sound the spell makes when it is cast
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0, mob/living/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(((!user.mind) || !(src in user.mind.spell_list)) && !(src in user.mob_spell_list))
to_chat(user, "<span class='warning'>You shouldn't have this spell! Something's wrong.</span>")
return 0
if(istype(user, /mob/living/carbon/human))
if(ishuman(user))
var/mob/living/carbon/human/caster = user
if(caster.remoteview_target)
caster.remoteview_target = null
@@ -129,26 +131,31 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
if(!ghost)
if(user.stat && !stat_allowed)
to_chat(user, "Not when you're incapacitated.")
to_chat(user, "<span class='notice'>You can't cast this spell while incapacitated.</span>")
return 0
if(ishuman(user) && (invocation_type == "whisper" || invocation_type == "shout") && user.is_muzzled())
to_chat(user, "Mmmf mrrfff!")
return 0
var/obj/effect/proc_holder/spell/noclothes/spell = locate() in (user.mob_spell_list | (user.mind ? user.mind.spell_list : list()))
if(clothes_req && !(spell && istype(spell)))//clothes check
if(!istype(user, /mob/living/carbon/human))
to_chat(user, "You aren't a human, Why are you trying to cast a human spell, silly non-human? Casting human spells is for humans.")
var/obj/effect/proc_holder/spell/noclothes/clothes_spell = locate() in (user.mob_spell_list | (user.mind ? user.mind.spell_list : list()))
if((ishuman(user) && clothes_req) && !(clothes_spell && istype(clothes_spell)))//clothes check
var/mob/living/carbon/human/H = user
if(!istype(H.wear_suit, /obj/item/clothing/suit/wizrobe) && !istype(H.wear_suit, /obj/item/clothing/suit/space/rig/wizard))
to_chat(user, "<span class='notice'>I don't feel strong enough without my robe.</span>")
return 0
if(!istype(user:wear_suit, /obj/item/clothing/suit/wizrobe) && !istype(user:wear_suit, /obj/item/clothing/suit/space/rig/wizard))
to_chat(user, "I don't feel strong enough without my robe.")
if(!istype(H.shoes, /obj/item/clothing/shoes/sandal))
to_chat(user, "<span class='notice'>I don't feel strong enough without my sandals.</span>")
return 0
if(!istype(user:shoes, /obj/item/clothing/shoes/sandal))
to_chat(user, "I don't feel strong enough without my sandals.")
return 0
if(!istype(user:head, /obj/item/clothing/head/wizard) && !istype(user:head, /obj/item/clothing/head/helmet/space/rig/wizard))
if(!istype(H.head, /obj/item/clothing/head/wizard) && !istype(H.head, /obj/item/clothing/head/helmet/space/rig/wizard))
to_chat(user, "<span class='notice'>I don't feel strong enough without my hat.</span>")
return 0
else if(!ishuman(user))
if(clothes_req || human_req)
to_chat(user, "<span class='notice'>This spell can only be cast by humans!</span>")
return 0
if(nonabstract_req && (isbrain(user) || ispAI(user)))
to_chat(user, "<span class='notice'>This spell can only be cast by physical beings!</span>")
return 0
if(!skipcharge)
switch(charge_type)
@@ -426,7 +433,6 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
return 0
if(ishuman(user))
var/mob/living/carbon/human/H = user
if((invocation_type == "whisper" || invocation_type == "shout") && H.is_muzzled())
@@ -442,8 +448,8 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
if(!istype(H.head, /obj/item/clothing/head/wizard) && !istype(H.head, /obj/item/clothing/head/helmet/space/rig/wizard))
return 0
else
if(clothes_req)
if(clothes_req || human_req)
return 0
if(isbrain(user) || ispAI(user))
if(nonabstract_req && (isbrain(user) || ispAI(user)))
return 0
return 1
+2 -1
View File
@@ -1,7 +1,8 @@
/obj/effect/proc_holder/spell/targeted/area_teleport
name = "Area teleport"
desc = "This spell teleports you to a type of area of your selection."
nonabstract_req = 1
var/randomise_selection = 0 //if it lets the usr choose the teleport loc or picks it from the list
var/invocation_area = 1 //if the invocation appends the selected area
+1
View File
@@ -10,6 +10,7 @@
range = -1
cooldown_min = 100 //50 deciseconds reduction per rank
include_user = 1
nonabstract_req = 1
centcom_cancast = 0 //Prevent people from getting to centcom
var phaseshift = 0
+2
View File
@@ -11,6 +11,7 @@
clothes_req = 0
range = 0
cast_sound = null
human_req = 1
action_icon_state = "mime"
action_background_icon_state = "bg_mime"
@@ -35,6 +36,7 @@
charge_max = 3000
range = -1
include_user = 1
human_req = 1
action_icon_state = "mime"
action_background_icon_state = "bg_mime"
+82
View File
@@ -0,0 +1,82 @@
/obj/effect/proc_holder/spell/targeted/shapeshift
name = "Shapechange"
desc = "Take on the shape of another for a time to use their natural abilities. Once you've made your choice it cannot be changed."
clothes_req = 0
human_req = 0
charge_max = 200
cooldown_min = 50
range = -1
include_user = 1
invocation = "RAC'WA NO!"
invocation_type = "shout"
action_icon_state = "shapeshift"
var/shapeshift_type
var/list/current_shapes = list()
var/list/current_casters = list()
var/list/possible_shapes = list(/mob/living/simple_animal/mouse,\
/mob/living/simple_animal/pet/corgi,\
/mob/living/simple_animal/bot/ed209,\
/mob/living/simple_animal/hostile/construct/armoured)
/obj/effect/proc_holder/spell/targeted/shapeshift/cast(list/targets, mob/user = usr)
for(var/mob/living/M in targets)
if(!shapeshift_type)
var/list/animal_list = list()
for(var/path in possible_shapes)
var/mob/living/simple_animal/A = path
animal_list[initial(A.name)] = path
shapeshift_type = input(M, "Choose Your Animal Form!", "It's Morphing Time!", null) as anything in animal_list
if(!shapeshift_type) //If you aren't gonna decide I am!
shapeshift_type = pick(animal_list)
shapeshift_type = animal_list[shapeshift_type]
if(M in current_shapes)
Restore(M)
else
Shapeshift(M)
/obj/effect/proc_holder/spell/targeted/shapeshift/proc/Shapeshift(mob/living/caster)
for(var/mob/living/M in caster)
if(M.status_flags & GODMODE)
to_chat(caster, "<span class='warning'>You're already shapeshifted!</span>")
return
var/mob/living/shape = new shapeshift_type(caster.loc)
caster.loc = shape
caster.status_flags |= GODMODE
current_shapes |= shape
current_casters |= caster
clothes_req = 0
human_req = 0
caster.mind.transfer_to(shape)
/obj/effect/proc_holder/spell/targeted/shapeshift/proc/Restore(mob/living/shape)
var/mob/living/caster
for(var/mob/living/M in shape)
if(M in current_casters)
caster = M
break
if(!caster)
return
caster.loc = shape.loc
caster.status_flags &= ~GODMODE
clothes_req = initial(clothes_req)
human_req = initial(human_req)
current_casters.Remove(caster)
current_shapes.Remove(shape)
shape.mind.transfer_to(caster)
qdel(shape) //Gib it maybe ?
/obj/effect/proc_holder/spell/targeted/shapeshift/dragon
name = "Dragon Form"
desc = "Take on the shape a lesser ash drake."
invocation = "RAAAAAAAAWR!"
shapeshift_type = /mob/living/simple_animal/hostile/megafauna/dragon/lesser
list/current_shapes = list(/mob/living/simple_animal/hostile/megafauna/dragon/lesser)
list/current_casters = list()
list/possible_shapes = list(/mob/living/simple_animal/hostile/megafauna/dragon/lesser)
+1
View File
@@ -1,6 +1,7 @@
/obj/effect/proc_holder/spell/targeted/turf_teleport
name = "Turf Teleport"
desc = "This spell teleports the target to the turf in range."
nonabstract_req = 1
var/inner_tele_radius = 1
var/outer_tele_radius = 2