Datum antag wizard.

This commit is contained in:
AnturK
2017-10-11 12:23:26 +02:00
committed by CitadelStationBot
parent 6b10a53724
commit 5be4669924
19 changed files with 664 additions and 308 deletions
+5 -4
View File
@@ -1,20 +1,21 @@
GLOBAL_LIST_EMPTY(antagonists)
/datum/antagonist
var/name = "Antagonist"
var/datum/mind/owner //Mind that owns this datum
var/silent = FALSE //Silent will prevent the gain/lose texts to show
var/can_coexist_with_others = TRUE //Whether or not the person will be able to have more than one datum
var/list/typecache_datum_blacklist = list() //List of datums this type can't coexist with
var/delete_on_death = TRUE
var/delete_on_mind_deletion = TRUE
/datum/antagonist/New(datum/mind/new_owner)
GLOB.antagonists += src
typecache_datum_blacklist = typecacheof(typecache_datum_blacklist)
if(new_owner)
owner = new_owner
/datum/antagonist/Destroy()
GLOB.antagonists -= src
if(owner)
LAZYREMOVE(owner.antag_datums, src)
owner = null
+1 -1
View File
@@ -131,7 +131,7 @@
/datum/antagonist/cult/master/on_gain()
. = ..()
var/mob/living/current = owner.current
SSticker.mode.set_antag_hud(current, "cultmaster")
set_antag_hud(current, "cultmaster")
/datum/antagonist/cult/master/greet()
to_chat(owner.current, "<span class='cultlarge'>You are the cult's Master</span>. As the cult's Master, you have a unique title and loud voice when communicating, are capable of marking \
+1 -1
View File
@@ -86,7 +86,7 @@ GLOBAL_LIST_INIT(devil_syllable, list("hal", "ve", "odr", "neit", "ci", "quon",
GLOBAL_LIST_INIT(devil_suffix, list(" the Red", " the Soulless", " the Master", ", the Lord of all things", ", Jr."))
/datum/antagonist/devil
//Don't delete upon mind destruction, otherwise soul re-selling will break.
delete_on_death = FALSE
delete_on_mind_deletion = FALSE
var/obligation
var/ban
var/bane
+273
View File
@@ -0,0 +1,273 @@
#define APPRENTICE_DESTRUCTION "destruction"
#define APPRENTICE_BLUESPACE "bluespace"
#define APPRENTICE_ROBELESS "robeless"
#define APPRENTICE_HEALING "healing"
/datum/antagonist/wizard
name = "Space Wizard"
var/give_objectives = TRUE
var/strip = TRUE //strip before equipping
var/allow_rename = TRUE
var/hud_version = "wizard"
var/datum/objective_team/wizard/wiz_team //Only created if wizard summons apprentices
var/list/objectives = list() //this should be base datum antag proc and list, todo make lazy
var/move_to_lair = TRUE
var/outfit_type = /datum/outfit/wizard
var/wiz_age = WIZARD_AGE_MIN /* Wizards by nature cannot be too young. */
/datum/antagonist/wizard/on_gain()
register()
if(give_objectives)
create_objectives()
equip_wizard()
if(move_to_lair)
send_to_lair()
. = ..()
if(allow_rename)
rename_wizard()
/datum/antagonist/wizard/proc/register()
SSticker.mode.wizards |= owner
/datum/antagonist/wizard/proc/unregister()
SSticker.mode.wizards -= src
/datum/objective_team/wizard
name = "wizard team"
/datum/antagonist/wizard/proc/create_wiz_team()
wiz_team = new(owner)
wiz_team.name = "[owner.current.real_name] team"
update_wiz_icons_added(owner.current)
/datum/antagonist/wizard/proc/send_to_lair()
if(!owner || !owner.current)
return
if(!GLOB.wizardstart.len)
SSjob.SendToLateJoin(owner.current)
to_chat(owner, "HOT INSERTION, GO GO GO")
owner.current.forceMove(pick(GLOB.wizardstart))
/datum/antagonist/wizard/proc/create_objectives()
switch(rand(1,100))
if(1 to 30)
var/datum/objective/assassinate/kill_objective = new
kill_objective.owner = owner
kill_objective.find_target()
objectives += kill_objective
if (!(locate(/datum/objective/escape) in owner.objectives))
var/datum/objective/escape/escape_objective = new
escape_objective.owner = owner
objectives += escape_objective
if(31 to 60)
var/datum/objective/steal/steal_objective = new
steal_objective.owner = owner
steal_objective.find_target()
objectives += steal_objective
if (!(locate(/datum/objective/escape) in owner.objectives))
var/datum/objective/escape/escape_objective = new
escape_objective.owner = owner
objectives += escape_objective
if(61 to 85)
var/datum/objective/assassinate/kill_objective = new
kill_objective.owner = owner
kill_objective.find_target()
objectives += kill_objective
var/datum/objective/steal/steal_objective = new
steal_objective.owner = owner
steal_objective.find_target()
objectives += steal_objective
if (!(locate(/datum/objective/survive) in owner.objectives))
var/datum/objective/survive/survive_objective = new
survive_objective.owner = owner
objectives += survive_objective
else
if (!(locate(/datum/objective/hijack) in owner.objectives))
var/datum/objective/hijack/hijack_objective = new
hijack_objective.owner = owner
objectives += hijack_objective
for(var/datum/objective/O in objectives)
owner.objectives += O
/datum/antagonist/wizard/on_removal()
unregister()
owner.RemoveAllSpells() // TODO keep track which spells are wizard spells which innate stuff
return ..()
/datum/antagonist/wizard/proc/equip_wizard()
if(!owner)
return
var/mob/living/carbon/human/H = owner.current
if(!istype(H))
return
if(strip)
H.delete_equipment()
//Wizards are human by default. Use the mirror if you want something else.
H.set_species(/datum/species/human)
if(H.age < wiz_age)
H.age = wiz_age
H.equipOutfit(outfit_type)
/datum/antagonist/wizard/greet()
to_chat(owner, "<span class='boldannounce'>You are the Space Wizard!</span>")
to_chat(owner, "<B>The Space Wizards Federation has given you the following tasks:</B>")
owner.announce_objectives()
to_chat(owner, "You will find a list of available spells in your spell book. Choose your magic arsenal carefully.")
to_chat(owner, "The spellbook is bound to you, and others cannot use it.")
to_chat(owner, "In your pockets you will find a teleport scroll. Use it as needed.")
to_chat(owner,"<B>Remember:</B> do not forget to prepare your spells.")
/datum/antagonist/wizard/farewell()
to_chat(owner, "<span class='userdanger'>You have been brainwashed! You are no longer a wizard!</span>")
/datum/antagonist/wizard/proc/rename_wizard()
set waitfor = FALSE
var/wizard_name_first = pick(GLOB.wizard_first)
var/wizard_name_second = pick(GLOB.wizard_second)
var/randomname = "[wizard_name_first] [wizard_name_second]"
var/mob/living/wiz_mob = owner.current
var/newname = copytext(sanitize(input(wiz_mob, "You are the [name]. Would you like to change your name to something else?", "Name change", randomname) as null|text),1,MAX_NAME_LEN)
if (!newname)
newname = randomname
wiz_mob.fully_replace_character_name(wiz_mob.real_name, newname)
/datum/antagonist/wizard/apply_innate_effects(mob/living/mob_override)
var/mob/living/M = mob_override || owner.current
if(wiz_team) //Don't bother with the icon if you're solo wizard
update_wiz_icons_added(M)
M.faction |= "wizard"
/datum/antagonist/wizard/remove_innate_effects(mob/living/mob_override)
var/mob/living/M = mob_override || owner.current
update_wiz_icons_removed(M)
M.faction -= "wizard"
/datum/antagonist/wizard/apprentice
name = "Wizard Apprentice"
hud_version = "apprentice"
var/datum/mind/master
var/school = APPRENTICE_DESTRUCTION
outfit_type = /datum/outfit/wizard/apprentice
wiz_age = APPRENTICE_AGE_MIN
/datum/antagonist/wizard/apprentice/greet()
to_chat(owner, "<B>You are [master.current.real_name]'s apprentice! You are bound by magic contract to follow their orders and help them in accomplishing their goals.")
owner.announce_objectives()
/datum/antagonist/wizard/apprentice/register()
SSticker.mode.apprentices |= src
/datum/antagonist/wizard/apprentice/unregister()
SSticker.mode.apprentices -= src
/datum/antagonist/wizard/apprentice/equip_wizard()
. = ..()
if(!owner)
return
var/mob/living/carbon/human/H = owner.current
if(!istype(H))
return
switch(school)
if(APPRENTICE_DESTRUCTION)
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/projectile/magic_missile(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/aimed/fireball(null))
to_chat(owner, "<B>Your service has not gone unrewarded, however. Studying under [master.current.real_name], you have learned powerful, destructive spells. You are able to cast magic missile and fireball.")
if(APPRENTICE_BLUESPACE)
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/area_teleport/teleport(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/ethereal_jaunt(null))
to_chat(owner, "<B>Your service has not gone unrewarded, however. Studying under [master.current.real_name], you have learned reality bending mobility spells. You are able to cast teleport and ethereal jaunt.")
if(APPRENTICE_HEALING)
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/charge(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/forcewall(null))
H.put_in_hands(new /obj/item/gun/magic/staff/healing(H))
to_chat(owner, "<B>Your service has not gone unrewarded, however. Studying under [master.current.real_name], you have learned livesaving survival spells. You are able to cast charge and forcewall.")
if(APPRENTICE_HEALING)
owner.AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/knock(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/mind_transfer(null))
to_chat(owner, "<B>Your service has not gone unrewarded, however. Studying under [master.current.real_name], you have learned stealthy, robeless spells. You are able to cast knock and mindswap.")
/datum/antagonist/wizard/apprentice/create_objectives()
var/datum/objective/protect/new_objective = new /datum/objective/protect
new_objective.owner = owner
new_objective.target = master
new_objective.explanation_text = "Protect [master.current.real_name], the wizard."
owner.objectives += new_objective
objectives += new_objective
//Random event wizard
/datum/antagonist/wizard/apprentice/imposter
name = "Wizard Imposter"
allow_rename = FALSE
/datum/antagonist/wizard/apprentice/imposter/greet()
to_chat(owner, "<B>You are an imposter! Trick and confuse the crew to misdirect malice from your handsome original!</B>")
owner.announce_objectives()
/datum/antagonist/wizard/apprentice/imposter/equip_wizard()
var/mob/living/carbon/human/master_mob = master.current
var/mob/living/carbon/human/H = owner.current
if(!istype(master_mob) || !istype(H))
return
if(master_mob.ears)
H.equip_to_slot_or_del(new master_mob.ears.type, slot_ears)
if(master_mob.w_uniform)
H.equip_to_slot_or_del(new master_mob.w_uniform.type, slot_w_uniform)
if(master_mob.shoes)
H.equip_to_slot_or_del(new master_mob.shoes.type, slot_shoes)
if(master_mob.wear_suit)
H.equip_to_slot_or_del(new master_mob.wear_suit.type, slot_wear_suit)
if(master_mob.head)
H.equip_to_slot_or_del(new master_mob.head.type, slot_head)
if(master_mob.back)
H.equip_to_slot_or_del(new master_mob.back.type, slot_back)
//Operation: Fuck off and scare people
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/area_teleport/teleport(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/turf_teleport/blink(null))
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/ethereal_jaunt(null))
/datum/antagonist/wizard/proc/update_wiz_icons_added(mob/living/wiz)
var/datum/atom_hud/antag/wizhud = GLOB.huds[ANTAG_HUD_WIZ]
wizhud.join_hud(wiz)
set_antag_hud(wiz, hud_version)
/datum/antagonist/wizard/proc/update_wiz_icons_removed(mob/living/wiz)
var/datum/atom_hud/antag/wizhud = GLOB.huds[ANTAG_HUD_WIZ]
wizhud.leave_hud(wiz)
set_antag_hud(wiz, null)
/datum/antagonist/wizard/academy
name = "Academy Teacher"
outfit_type = /datum/outfit/wizard/academy
/datum/antagonist/wizard/academy/equip_wizard()
. = ..()
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/ethereal_jaunt)
owner.AddSpell(new /obj/effect/proc_holder/spell/targeted/projectile/magic_missile)
owner.AddSpell(new /obj/effect/proc_holder/spell/aimed/fireball)
var/mob/living/M = owner.current
if(!istype(M))
return
var/obj/item/implant/exile/Implant = new/obj/item/implant/exile(M)
Implant.implant(M)
/datum/antagonist/wizard/academy/create_objectives()
var/datum/objective/new_objective = new("Protect Wizard Academy from the intruders")
new_objective.owner = owner
owner.objectives += new_objective
objectives += new_objective
+19 -41
View File
@@ -75,7 +75,7 @@
if(islist(antag_datums))
for(var/i in antag_datums)
var/datum/antagonist/antag_datum = i
if(antag_datum.delete_on_death)
if(antag_datum.delete_on_mind_deletion)
qdel(i)
antag_datums = null
return ..()
@@ -133,10 +133,16 @@
memory = null
// Datum antag mind procs
/datum/mind/proc/add_antag_datum(datum_type, team)
if(!datum_type)
/datum/mind/proc/add_antag_datum(datum_type_or_instance, team)
if(!datum_type_or_instance)
return
var/datum/antagonist/A = new datum_type(src, team)
var/datum/antagonist/A
if(!ispath(datum_type_or_instance))
A = datum_type_or_instance
if(!istype(A))
return
else
A = new datum_type_or_instance(src, team)
if(!A.can_be_owned(src))
qdel(A)
return
@@ -193,12 +199,12 @@
/datum/mind/proc/remove_traitor()
if(src in SSticker.mode.traitors)
src.remove_antag_datum(ANTAG_DATUM_TRAITOR)
remove_antag_datum(ANTAG_DATUM_TRAITOR)
SSticker.mode.update_traitor_icons_removed(src)
/datum/mind/proc/remove_brother()
if(src in SSticker.mode.brothers)
src.remove_antag_datum(ANTAG_DATUM_BROTHER)
remove_antag_datum(ANTAG_DATUM_BROTHER)
SSticker.mode.update_brother_icons_removed(src)
/datum/mind/proc/remove_nukeop()
@@ -210,11 +216,8 @@
remove_antag_equip()
/datum/mind/proc/remove_wizard()
if(src in SSticker.mode.wizards)
SSticker.mode.wizards -= src
RemoveAllSpells()
remove_antag_datum(/datum/antagonist/wizard)
special_role = null
remove_antag_equip()
/datum/mind/proc/remove_cultist()
if(src in SSticker.mode.cult)
@@ -254,7 +257,6 @@
remove_rev()
SSticker.mode.update_changeling_icons_removed(src)
SSticker.mode.update_traitor_icons_removed(src)
SSticker.mode.update_wiz_icons_removed(src)
SSticker.mode.update_cult_icons_removed(src)
SSticker.mode.update_rev_icons_removed(src)
@@ -526,11 +528,9 @@
if (SSticker.mode.config_tag=="wizard")
text = uppertext(text)
text = "<i><b>[text]</b></i>: "
if ((src in SSticker.mode.wizards) || (src in SSticker.mode.apprentices))
if (has_antag_datum(/datum/antagonist/wizard))
text += "<b>YES</b> | <a href='?src=\ref[src];wizard=clear'>no</a>"
text += "<br><a href='?src=\ref[src];wizard=lair'>To lair</a>, <a href='?src=\ref[src];common=undress'>undress</a>, <a href='?src=\ref[src];wizard=dressup'>dress up</a>, <a href='?src=\ref[src];wizard=name'>let choose name</a>."
if (objectives.len==0)
text += "<br>Objectives are empty! <a href='?src=\ref[src];wizard=autoobjectives'>Randomize!</a>"
text += "<br><a href='?src=\ref[src];wizard=lair'>To lair</a>, <a href='?src=\ref[src];common=undress'>undress</a>"
else
text += "<a href='?src=\ref[src];wizard=wizard'>yes</a> | <b>NO</b>"
@@ -1049,27 +1049,15 @@
switch(href_list["wizard"])
if("clear")
remove_wizard()
to_chat(current, "<span class='userdanger'>You have been brainwashed! You are no longer a wizard!</span>")
log_admin("[key_name(usr)] has de-wizard'ed [current].")
SSticker.mode.update_wiz_icons_removed(src)
if("wizard")
if(!(src in SSticker.mode.wizards))
SSticker.mode.wizards += src
if(has_antag_datum(/datum/antagonist/wizard))
special_role = "Wizard"
//SSticker.mode.learn_basic_spells(current)
to_chat(current, "<span class='boldannounce'>You are the Space Wizard!</span>")
add_antag_datum(/datum/antagonist/wizard)
message_admins("[key_name_admin(usr)] has wizard'ed [current].")
log_admin("[key_name(usr)] has wizard'ed [current].")
SSticker.mode.update_wiz_icons_added(src)
if("lair")
current.forceMove(pick(GLOB.wizardstart))
if("dressup")
SSticker.mode.equip_wizard(current)
if("name")
SSticker.mode.name_wizard(current)
if("autoobjectives")
SSticker.mode.forge_wizard_objectives(src)
to_chat(usr, "<span class='notice'>The objectives for wizard [key] have been generated. You can edit them and anounce manually.</span>")
else if (href_list["changeling"])
switch(href_list["changeling"])
@@ -1440,20 +1428,10 @@
SSticker.mode.update_changeling_icons_added(src)
/datum/mind/proc/make_Wizard()
if(!(src in SSticker.mode.wizards))
SSticker.mode.wizards += src
if(!has_antag_datum(/datum/antagonist/wizard))
special_role = "Wizard"
assigned_role = "Wizard"
if(!GLOB.wizardstart.len)
SSjob.SendToLateJoin(current)
to_chat(current, "HOT INSERTION, GO GO GO")
else
current.forceMove(pick(GLOB.wizardstart))
SSticker.mode.equip_wizard(current)
SSticker.mode.name_wizard(current)
SSticker.mode.forge_wizard_objectives(src)
SSticker.mode.greet_wizard(src)
add_antag_datum(/datum/antagonist/wizard)
/datum/mind/proc/make_Cultist()