Datum antag wizard.
This commit is contained in:
committed by
CitadelStationBot
parent
6b10a53724
commit
5be4669924
@@ -29,7 +29,7 @@
|
||||
|
||||
//GAME_MODE PROCS
|
||||
//called to set a mob's antag icon state
|
||||
/datum/game_mode/proc/set_antag_hud(mob/M, new_icon_state)
|
||||
/proc/set_antag_hud(mob/M, new_icon_state)
|
||||
if(!istype(M))
|
||||
CRASH("set_antag_hud(): [M] ([M.type]) is not a mob!")
|
||||
var/image/holder = M.hud_list[ANTAG_HUD]
|
||||
@@ -43,7 +43,7 @@
|
||||
//these are called by mind.transfer_to()
|
||||
/datum/mind/proc/transfer_antag_huds(datum/atom_hud/antag/newhud)
|
||||
leave_all_antag_huds()
|
||||
SSticker.mode.set_antag_hud(current, antag_hud_icon_state)
|
||||
set_antag_hud(current, antag_hud_icon_state)
|
||||
if(newhud)
|
||||
newhud.join_hud(current)
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
dat += "<I>Using this contract, you may summon an apprentice to aid you on your mission.</I><BR>"
|
||||
dat += "<I>If you are unable to establish contact with your apprentice, you can feed the contract back to the spellbook to refund your points.</I><BR>"
|
||||
dat += "<B>Which school of magic is your apprentice studying?:</B><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=destruction'>Destruction</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=[APPRENTICE_DESTRUCTION]'>Destruction</A><BR>"
|
||||
dat += "<I>Your apprentice is skilled in offensive magic. They know Magic Missile and Fireball.</I><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=bluespace'>Bluespace Manipulation</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=[APPRENTICE_BLUESPACE]'>Bluespace Manipulation</A><BR>"
|
||||
dat += "<I>Your apprentice is able to defy physics, melting through solid objects and travelling great distances in the blink of an eye. They know Teleport and Ethereal Jaunt.</I><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=healing'>Healing</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=[APPRENTICE_HEALING]'>Healing</A><BR>"
|
||||
dat += "<I>Your apprentice is training to cast spells that will aid your survival. They know Forcewall and Charge and come with a Staff of Healing.</I><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=robeless'>Robeless</A><BR>"
|
||||
dat += "<A href='byond://?src=\ref[src];school=[APPRENTICE_ROBELESS]'>Robeless</A><BR>"
|
||||
dat += "<I>Your apprentice is training to cast spells without their robes. They know Knock and Mindswap.</I><BR>"
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
@@ -63,73 +63,31 @@
|
||||
return
|
||||
used = 1
|
||||
var/mob/dead/observer/theghost = pick(candidates)
|
||||
spawn_antag(theghost.client, get_turf(src), href_list["school"])
|
||||
if(H && H.mind)
|
||||
SSticker.mode.update_wiz_icons_added(H.mind)
|
||||
spawn_antag(theghost.client, get_turf(src), href_list["school"],H.mind)
|
||||
else
|
||||
to_chat(H, "Unable to reach your apprentice! You can either attack the spellbook with the contract to refund your points, or wait and try again later.")
|
||||
|
||||
/obj/item/antag_spawner/contract/spawn_antag(client/C, turf/T, type = "")
|
||||
/obj/item/antag_spawner/contract/spawn_antag(client/C, turf/T, school,datum/mind/wizard)
|
||||
new /obj/effect/particle_effect/smoke(T)
|
||||
var/mob/living/carbon/human/M = new/mob/living/carbon/human(T)
|
||||
C.prefs.copy_to(M)
|
||||
M.key = C.key
|
||||
var/wizard_name = "the wizard"
|
||||
if(usr)
|
||||
wizard_name = usr.real_name
|
||||
to_chat(M, "<B>You are [wizard_name]'s apprentice! You are bound by magic contract to follow their orders and help them in accomplishing their goals.")
|
||||
switch(type)
|
||||
if("destruction")
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/projectile/magic_missile(null))
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/aimed/fireball(null))
|
||||
to_chat(M, "<B>Your service has not gone unrewarded, however. Studying under [wizard_name], you have learned powerful, destructive spells. You are able to cast magic missile and fireball.")
|
||||
if("bluespace")
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/area_teleport/teleport(null))
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/ethereal_jaunt(null))
|
||||
to_chat(M, "<B>Your service has not gone unrewarded, however. Studying under [wizard_name], you have learned reality bending mobility spells. You are able to cast teleport and ethereal jaunt.")
|
||||
if("healing")
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/charge(null))
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/forcewall(null))
|
||||
M.put_in_hands(new /obj/item/gun/magic/staff/healing(M), TRUE)
|
||||
to_chat(M, "<B>Your service has not gone unrewarded, however. Studying under [wizard_name], you have learned livesaving survival spells. You are able to cast charge and forcewall.")
|
||||
if("robeless")
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/aoe_turf/knock(null))
|
||||
M.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/mind_transfer(null))
|
||||
to_chat(M, "<B>Your service has not gone unrewarded, however. Studying under [wizard_name], you have learned stealthy, robeless spells. You are able to cast knock and mindswap.")
|
||||
|
||||
equip_antag(M)
|
||||
var/wizard_name_first = pick(GLOB.wizard_first)
|
||||
var/wizard_name_second = pick(GLOB.wizard_second)
|
||||
var/randomname = "[wizard_name_first] [wizard_name_second]"
|
||||
if(usr)
|
||||
var/datum/objective/protect/new_objective = new /datum/objective/protect
|
||||
new_objective.owner = M.mind
|
||||
new_objective.target = usr.mind
|
||||
new_objective.explanation_text = "Protect [usr.real_name], the wizard."
|
||||
M.mind.objectives += new_objective
|
||||
SSticker.mode.apprentices += M.mind
|
||||
M.mind.assigned_role = "Apprentice"
|
||||
M.mind.special_role = "apprentice"
|
||||
SSticker.mode.update_wiz_icons_added(M.mind)
|
||||
var/datum/mind/app_mind = M.mind
|
||||
var/datum/antagonist/wizard/master_antag = wizard.has_antag_datum(/datum/antagonist/wizard)
|
||||
if(!master_antag.wiz_team)
|
||||
master_antag.create_wiz_team()
|
||||
var/datum/antagonist/wizard/apprentice/app = new(app_mind)
|
||||
app.wiz_team = master_antag.wiz_team
|
||||
app.master = wizard
|
||||
app.school = school
|
||||
master_antag.wiz_team.members += app_mind
|
||||
app_mind.add_antag_datum(app)
|
||||
//TODO Kill these if possible
|
||||
app_mind.assigned_role = "Apprentice"
|
||||
app_mind.special_role = "apprentice"
|
||||
//
|
||||
SEND_SOUND(M, sound('sound/effects/magic.ogg'))
|
||||
var/newname = copytext(sanitize(input(M, "You are [wizard_name]'s apprentice. Would you like to change your name to something else?", "Name change", randomname) as null|text),1,MAX_NAME_LEN)
|
||||
if (!newname)
|
||||
newname = randomname
|
||||
M.mind.name = newname
|
||||
M.real_name = newname
|
||||
M.name = newname
|
||||
M.age = rand(AGE_MIN, WIZARD_AGE_MIN - 1)
|
||||
M.dna.update_dna_identity()
|
||||
|
||||
/obj/item/antag_spawner/contract/equip_antag(mob/target)
|
||||
target.equip_to_slot_or_del(new /obj/item/device/radio/headset(target), slot_ears)
|
||||
target.equip_to_slot_or_del(new /obj/item/clothing/under/color/lightpurple(target), slot_w_uniform)
|
||||
target.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(target), slot_shoes)
|
||||
target.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe(target), slot_wear_suit)
|
||||
target.equip_to_slot_or_del(new /obj/item/clothing/head/wizard(target), slot_head)
|
||||
target.equip_to_slot_or_del(new /obj/item/storage/backpack(target), slot_back)
|
||||
target.equip_to_slot_or_del(new /obj/item/storage/box(target), slot_in_backpack)
|
||||
target.equip_to_slot_or_del(new /obj/item/teleportation_scroll/apprentice(target), slot_r_store)
|
||||
///////////BORGS AND OPERATIVES
|
||||
|
||||
|
||||
|
||||
@@ -737,7 +737,7 @@
|
||||
for(var/obj/effect/proc_holder/spell/knownspell in user.mind.spell_list)
|
||||
if(knownspell.type == S.type)
|
||||
if(user.mind)
|
||||
if(user.mind.special_role == "apprentice" || user.mind.special_role == "Wizard")
|
||||
if(iswizard(user))
|
||||
to_chat(user,"<span class='notice'>You're already far more versed in this spell than this flimsy how-to book can provide.</span>")
|
||||
else
|
||||
to_chat(user,"<span class='notice'>You've already read this one.</span>")
|
||||
|
||||
@@ -16,160 +16,34 @@
|
||||
announce_text = "There is a space wizard attacking the station!\n\
|
||||
<span class='danger'>Wizard</span>: Accomplish your objectives and cause mayhem on the station.\n\
|
||||
<span class='notice'>Crew</span>: Eliminate the wizard before they can succeed!"
|
||||
var/use_huds = 0
|
||||
var/finished = 0
|
||||
|
||||
/datum/game_mode/wizard/pre_setup()
|
||||
|
||||
var/datum/mind/wizard = pick(antag_candidates)
|
||||
wizards += wizard
|
||||
modePlayer += wizard
|
||||
wizard.assigned_role = "Wizard"
|
||||
wizard.special_role = "Wizard"
|
||||
log_game("[wizard.key] (ckey) has been selected as a Wizard") //TODO: Move these to base antag datum
|
||||
if(GLOB.wizardstart.len == 0)
|
||||
to_chat(wizard.current, "<span class='boldannounce'>A starting location for you could not be found, please report this bug!</span>")
|
||||
return 0
|
||||
for(var/datum/mind/wiz in wizards)
|
||||
wiz.current.forceMove(pick(GLOB.wizardstart))
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
/datum/game_mode/wizard/post_setup()
|
||||
for(var/datum/mind/wizard in wizards)
|
||||
log_game("[wizard.key] (ckey) has been selected as a Wizard")
|
||||
equip_wizard(wizard.current)
|
||||
forge_wizard_objectives(wizard)
|
||||
if(use_huds)
|
||||
update_wiz_icons_added(wizard)
|
||||
greet_wizard(wizard)
|
||||
name_wizard(wizard.current)
|
||||
..()
|
||||
return
|
||||
wizard.add_antag_datum(/datum/antagonist/wizard)
|
||||
return ..()
|
||||
|
||||
/datum/game_mode/wizard/generate_report()
|
||||
return "A dangerous Wizards' Federation individual by the name of [pick(GLOB.wizard_first)] [pick(GLOB.wizard_second)] has recently escaped confinement from an unlisted prison facility. This \
|
||||
man is a dangerous mutant with the ability to alter himself and the world around him by what he and his leaders believe to be magic. If this man attempts an attack on your station, \
|
||||
his execution is highly encouraged, as is the preservation of his body for later study."
|
||||
|
||||
/datum/game_mode/proc/forge_wizard_objectives(datum/mind/wizard)
|
||||
switch(rand(1,100))
|
||||
if(1 to 30)
|
||||
|
||||
var/datum/objective/assassinate/kill_objective = new
|
||||
kill_objective.owner = wizard
|
||||
kill_objective.find_target()
|
||||
wizard.objectives += kill_objective
|
||||
|
||||
if (!(locate(/datum/objective/escape) in wizard.objectives))
|
||||
var/datum/objective/escape/escape_objective = new
|
||||
escape_objective.owner = wizard
|
||||
wizard.objectives += escape_objective
|
||||
if(31 to 60)
|
||||
var/datum/objective/steal/steal_objective = new
|
||||
steal_objective.owner = wizard
|
||||
steal_objective.find_target()
|
||||
wizard.objectives += steal_objective
|
||||
|
||||
if (!(locate(/datum/objective/escape) in wizard.objectives))
|
||||
var/datum/objective/escape/escape_objective = new
|
||||
escape_objective.owner = wizard
|
||||
wizard.objectives += escape_objective
|
||||
|
||||
if(61 to 85)
|
||||
var/datum/objective/assassinate/kill_objective = new
|
||||
kill_objective.owner = wizard
|
||||
kill_objective.find_target()
|
||||
wizard.objectives += kill_objective
|
||||
|
||||
var/datum/objective/steal/steal_objective = new
|
||||
steal_objective.owner = wizard
|
||||
steal_objective.find_target()
|
||||
wizard.objectives += steal_objective
|
||||
|
||||
if (!(locate(/datum/objective/survive) in wizard.objectives))
|
||||
var/datum/objective/survive/survive_objective = new
|
||||
survive_objective.owner = wizard
|
||||
wizard.objectives += survive_objective
|
||||
|
||||
else
|
||||
if (!(locate(/datum/objective/hijack) in wizard.objectives))
|
||||
var/datum/objective/hijack/hijack_objective = new
|
||||
hijack_objective.owner = wizard
|
||||
wizard.objectives += hijack_objective
|
||||
return
|
||||
|
||||
|
||||
/datum/game_mode/proc/name_wizard(mob/living/carbon/human/wizard_mob)
|
||||
//Allows the wizard to choose a custom name or go with a random one. Spawn 0 so it does not lag the round starting.
|
||||
var/wizard_name_first = pick(GLOB.wizard_first)
|
||||
var/wizard_name_second = pick(GLOB.wizard_second)
|
||||
var/randomname = "[wizard_name_first] [wizard_name_second]"
|
||||
spawn(0)
|
||||
var/newname = copytext(sanitize(input(wizard_mob, "You are the Space Wizard. Would you like to change your name to something else?", "Name change", randomname) as null|text),1,MAX_NAME_LEN)
|
||||
|
||||
if (!newname)
|
||||
newname = randomname
|
||||
|
||||
wizard_mob.fully_replace_character_name(wizard_mob.real_name, newname)
|
||||
|
||||
/* Wizards by nature cannot be too young. */
|
||||
if(wizard_mob.age < WIZARD_AGE_MIN)
|
||||
wizard_mob.age = WIZARD_AGE_MIN
|
||||
return
|
||||
|
||||
|
||||
/datum/game_mode/proc/greet_wizard(datum/mind/wizard, you_are=1)
|
||||
if (you_are)
|
||||
to_chat(wizard.current, "<span class='boldannounce'>You are the Space Wizard!</span>")
|
||||
to_chat(wizard.current, "<B>The Space Wizards Federation has given you the following tasks:</B>")
|
||||
|
||||
wizard.announce_objectives()
|
||||
return
|
||||
|
||||
|
||||
/datum/game_mode/proc/learn_basic_spells(mob/living/carbon/human/wizard_mob)
|
||||
if(!istype(wizard_mob) || !wizard_mob.mind)
|
||||
return 0
|
||||
wizard_mob.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/projectile/magic_missile(null)) //Wizards get Magic Missile and Ethereal Jaunt by default
|
||||
wizard_mob.mind.AddSpell(new /obj/effect/proc_holder/spell/targeted/ethereal_jaunt(null))
|
||||
|
||||
|
||||
/datum/game_mode/proc/equip_wizard(mob/living/carbon/human/wizard_mob)
|
||||
if (!istype(wizard_mob))
|
||||
return
|
||||
|
||||
//So zards properly get their items when they are admin-made.
|
||||
qdel(wizard_mob.wear_suit)
|
||||
qdel(wizard_mob.head)
|
||||
qdel(wizard_mob.shoes)
|
||||
for(var/obj/item/I in wizard_mob.held_items)
|
||||
qdel(I)
|
||||
qdel(wizard_mob.r_store)
|
||||
qdel(wizard_mob.l_store)
|
||||
|
||||
wizard_mob.set_species(/datum/species/human)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/device/radio/headset(wizard_mob), slot_ears)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/clothing/under/color/lightpurple(wizard_mob), slot_w_uniform)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/sandal/magic(wizard_mob), slot_shoes)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/clothing/suit/wizrobe(wizard_mob), slot_wear_suit)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/clothing/head/wizard(wizard_mob), slot_head)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/storage/backpack(wizard_mob), slot_back)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/storage/box/survival(wizard_mob), slot_in_backpack)
|
||||
wizard_mob.equip_to_slot_or_del(new /obj/item/teleportation_scroll(wizard_mob), slot_r_store)
|
||||
var/obj/item/spellbook/spellbook = new /obj/item/spellbook(wizard_mob)
|
||||
spellbook.owner = wizard_mob
|
||||
wizard_mob.put_in_hands(spellbook, TRUE)
|
||||
|
||||
to_chat(wizard_mob, "You will find a list of available spells in your spell book. Choose your magic arsenal carefully.")
|
||||
to_chat(wizard_mob, "The spellbook is bound to you, and others cannot use it.")
|
||||
to_chat(wizard_mob, "In your pockets you will find a teleport scroll. Use it as needed.")
|
||||
wizard_mob.mind.store_memory("<B>Remember:</B> do not forget to prepare your spells.")
|
||||
return 1
|
||||
|
||||
|
||||
/datum/game_mode/wizard/check_finished()
|
||||
|
||||
for(var/datum/mind/wizard in wizards)
|
||||
if(isliving(wizard.current) && wizard.current.stat!=DEAD)
|
||||
return ..()
|
||||
@@ -186,7 +60,6 @@
|
||||
to_chat(world, "<span class='userdanger'>The wizard[(wizards.len>1)?"s":""] has been killed by the crew! The Space Wizards Federation has been taught a lesson they will not soon forget!</span>")
|
||||
|
||||
SSticker.news_report = WIZARD_KILLED
|
||||
|
||||
..()
|
||||
return 1
|
||||
|
||||
@@ -247,20 +120,6 @@
|
||||
|
||||
to_chat(world, text)
|
||||
return 1
|
||||
|
||||
//OTHER PROCS
|
||||
|
||||
//returns whether the mob is a wizard (or apprentice)
|
||||
/proc/iswizard(mob/living/M)
|
||||
return istype(M) && M.mind && SSticker && SSticker.mode && ((M.mind in SSticker.mode.wizards) || (M.mind in SSticker.mode.apprentices))
|
||||
|
||||
|
||||
/datum/game_mode/proc/update_wiz_icons_added(datum/mind/wiz_mind)
|
||||
var/datum/atom_hud/antag/wizhud = GLOB.huds[ANTAG_HUD_WIZ]
|
||||
wizhud.join_hud(wiz_mind.current)
|
||||
set_antag_hud(wiz_mind.current, ((wiz_mind in wizards) ? "wizard" : "apprentice"))
|
||||
|
||||
/datum/game_mode/proc/update_wiz_icons_removed(datum/mind/wiz_mind)
|
||||
var/datum/atom_hud/antag/wizhud = GLOB.huds[ANTAG_HUD_WIZ]
|
||||
wizhud.leave_hud(wiz_mind.current)
|
||||
set_antag_hud(wiz_mind.current, null)
|
||||
return M.mind && M.mind.has_antag_datum(/datum/antagonist/wizard,TRUE)
|
||||
|
||||
Reference in New Issue
Block a user