/datum/game_mode/wizard
name = "wizard"
config_tag = "wizard"
tdm_gamemode = TRUE
required_players = 20
required_enemies = 1
recommended_enemies = 1
single_antag_positions = list()
var/finished = FALSE
var/but_wait_theres_more = FALSE
var/list/pre_wizards = list()
/datum/game_mode/wizard/announce()
to_chat(world, "The current game mode is - Wizard!")
to_chat(world, "There is a SPACE WIZARD on the station. You can't let him achieve his objective!")
/datum/game_mode/wizard/pre_setup()
var/list/datum/mind/possible_wizards = get_players_for_role(ROLE_WIZARD)
if(!length(possible_wizards))
return FALSE
var/datum/mind/wizard = pick(possible_wizards)
pre_wizards += wizard
wizard.assigned_role = SPECIAL_ROLE_WIZARD //So they aren't chosen for other jobs.
wizard.special_role = SPECIAL_ROLE_WIZARD
if(!length(GLOB.wizardstart))
to_chat(wizard.current, SPAN_DANGER("A starting location for you could not be found, please report this bug!"))
return FALSE
return TRUE
/datum/game_mode/wizard/post_setup()
for(var/datum/mind/wiz in pre_wizards)
wiz.add_antag_datum(/datum/antagonist/wizard)
wiz.current.forceMove(pick(GLOB.wizardstart))
var/mob/living/carbon/human/human_wizard = wiz.current // Honestly if the wizard isn't a human then someone else has gone horribly wrong
human_wizard.clear_quirks()
pre_wizards.Cut()
..()
// Checks if the game should end due to all wizards and apprentices being dead, or MMI'd/Borged
/datum/game_mode/wizard/check_finished()
if(but_wait_theres_more)
return ..()
// Wizards and Apprentices
for(var/datum/mind/wizard in (wizards + apprentices)) // yes, this works so it iterates through wizards, then apprentices
var/datum/antagonist/wizard/datum_wizard = wizard.has_antag_datum(/datum/antagonist/wizard)
if(datum_wizard?.wizard_is_alive())
return ..()
finished = TRUE
return TRUE
/datum/game_mode/wizard/declare_completion(ragin = 0)
if(finished && !ragin)
SSticker.mode_result = "wizard loss - wizard killed"
to_chat(world, SPAN_WARNING(" The wizard[(length(wizards)>1)?"s":""] has been killed by the crew! The Space Wizards Federation has been taught a lesson they will not soon forget!"))
..()
return TRUE
/datum/game_mode/proc/auto_declare_completion_wizard()
if(!length(wizards))
return
var/list/text = list("
the wizards/witches were:")
for(var/datum/mind/wizard in wizards)
text += "
[wizard.get_display_key()] was [wizard.name] ("
if(wizard.current)
if(wizard.current.stat == DEAD)
text += "died"
else
text += "survived"
if(wizard.current.real_name != wizard.name)
text += " as [wizard.current.real_name]"
else
text += "body destroyed"
text += ")"
var/count = 1
var/wizardwin = 1
for(var/datum/objective/objective in wizard.get_all_objectives(include_team = FALSE))
if(objective.check_completion())
text += "
Objective #[count]: [objective.explanation_text] Success!"
SSblackbox.record_feedback("nested tally", "wizard_objective", 1, list("[objective.type]", "SUCCESS"))
else
text += "
Objective #[count]: [objective.explanation_text] Fail."
SSblackbox.record_feedback("nested tally", "wizard_objective", 1, list("[objective.type]", "FAIL"))
wizardwin = 0
count++
if(wizard.current && wizard.current.stat != DEAD && wizardwin)
text += "
The wizard was successful!"
SSblackbox.record_feedback("tally", "wizard_success", 1, "SUCCESS")
else
text += "
The wizard has failed!"
SSblackbox.record_feedback("tally", "wizard_success", 1, "FAIL")
if(wizard.spell_list)
text += "
[wizard.name] used the following spells: "
text += english_list(wizard.spell_list)
text += "
"
return text.Join("")
//OTHER PROCS
//To batch-remove wizard spells. Linked to mind.dm
/mob/proc/spellremove()
if(!mind)
return
for(var/datum/spell/spell_to_remove in mind.spell_list)
qdel(spell_to_remove)
mind.spell_list -= spell_to_remove
//To batch-remove mob spells.
/mob/proc/mobspellremove()
for(var/datum/spell/spell_to_remove in mob_spell_list)
qdel(spell_to_remove)
mob_spell_list -= spell_to_remove
/proc/iswizard(mob/living/M)
return istype(M) && M.mind?.has_antag_datum(/datum/antagonist/wizard)