From a48abebc43550362bf3570752eefbd579ccc6203 Mon Sep 17 00:00:00 2001 From: DZD Date: Sat, 31 Jan 2015 20:49:36 -0500 Subject: [PATCH] Objective Finalization - Adds destroy AI objective to traitor objective rotation. - Adds maroon and destroy AI objectives to the traitor panel's "Add Objectives" button. --- code/datums/mind.dm | 61 +++++++++++++++---------- code/game/gamemodes/traitor/traitor.dm | 63 ++++++++++++++------------ 2 files changed, 71 insertions(+), 53 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 146b7b318ff..d03909fefbe 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -177,12 +177,12 @@ datum/mind text += "employee|headrev|REV" else text += "EMPLOYEE|headrev|rev" - + if(current && current.client && current.client.prefs.be_special & BE_REV) text += "|Enabled in Prefs" else text += "|Disabled in Prefs" - + sections["revolution"] = text /** CULT ***/ @@ -201,13 +201,13 @@ datum/mind */ else text += "EMPLOYEE|cultist" - + if(current && current.client && current.client.prefs.be_special & BE_CULTIST) text += "|Enabled in Prefs" else text += "|Disabled in Prefs" - + sections["cult"] = text /** WIZARD ***/ @@ -222,12 +222,12 @@ datum/mind text += "
Objectives are empty! Randomize!" else text += "yes|NO" - + if(current && current.client && current.client.prefs.be_special & BE_WIZARD) text += "|Enabled in Prefs" else text += "|Disabled in Prefs" - + sections["wizard"] = text /** CHANGELING ***/ @@ -243,12 +243,12 @@ datum/mind text += "
Transform to initial appearance." else text += "yes|NO" - + if(current && current.client && current.client.prefs.be_special & BE_CHANGELING) text += "|Enabled in Prefs" else text += "|Disabled in Prefs" - + sections["changeling"] = text /** NINJA ***/ @@ -263,12 +263,12 @@ datum/mind //text += "
Objectives are empty! Randomize!" else text += "yes|NO" - + if(current && current.client && current.client.prefs.be_special & BE_NINJA) text += "|Enabled in Prefs" else - text += "|Disabled in Prefs" - + text += "|Disabled in Prefs" + sections["ninja"] = text /** VAMPIRE ***/ @@ -282,15 +282,15 @@ datum/mind text += "
Objectives are empty! Randomize!" else text += "yes|NO" - + if(src in ticker.mode.enthralled) text += "YES|no" else text += "yes|NO" - + /** Enthralled ***/ text += "
enthralled" - + sections["vampire"] = text @@ -311,12 +311,12 @@ datum/mind text += " Code is [code]. tell the code." else text += "operative|NANOTRASEN" - + if(current && current.client && current.client.prefs.be_special & BE_OPERATIVE) text += "|Enabled in Prefs" else - text += "|Disabled in Prefs" - + text += "|Disabled in Prefs" + sections["nuclear"] = text /** TRAITOR ***/ @@ -333,12 +333,12 @@ datum/mind text += "
Objectives are empty! Randomize!" else text += "traitor|EMPLOYEE" - + if(current && current.client && current.client.prefs.be_special & BE_TRAITOR) text += "|Enabled in Prefs" else - text += "|Disabled in Prefs" - + text += "|Disabled in Prefs" + sections["traitor"] = text /** MONKEY ***/ @@ -359,12 +359,12 @@ datum/mind else text += "healthy|infected|human|OTHER" - + /*if(current && current.client && current.client.prefs.be_special & BE_MONKEY) text += "|Enabled in Prefs" else - text += "|Disabled in Prefs"*/ - + text += "|Disabled in Prefs"*/ + sections["monkey"] = text @@ -475,13 +475,13 @@ datum/mind if(!def_value)//If it's a custom objective, it will be an empty string. def_value = "custom" - var/new_obj_type = input("Select objective type:", "Objective type", def_value) as null|anything in list("assassinate", "blood", "debrain", "protect", "prevent", "harm", "speciesist", "brig", "hijack", "escape", "survive", "steal", "download", "nuclear", "capture", "absorb", "custom") + var/new_obj_type = input("Select objective type:", "Objective type", def_value) as null|anything in list("assassinate", "blood", "debrain", "protect", "prevent", "harm", "speciesist", "brig", "hijack", "escape", "survive", "steal", "download", "nuclear", "capture", "absorb", "destroy", "maroon", "custom") if (!new_obj_type) return var/datum/objective/new_objective = null switch (new_obj_type) - if ("assassinate","protect","debrain", "harm", "brig") + if ("assassinate","protect","debrain", "harm", "brig", "maroon") //To determine what to name the objective in explanation text. var/objective_type_capital = uppertext(copytext(new_obj_type, 1,2))//Capitalize first letter. var/objective_type_text = copytext(new_obj_type, 2)//Leave the rest of the text. @@ -513,6 +513,17 @@ datum/mind //Will display as special role if the target is set as MODE. Ninjas/commandos/nuke ops. new_objective.explanation_text = "[objective_type] [new_target:real_name], the [new_target:mind:assigned_role=="MODE" ? (new_target:mind:special_role) : (new_target:mind:assigned_role)]." + if ("destroy") + var/list/possible_targets = active_ais(1) + if(possible_targets.len) + var/mob/new_target = input("Select target:", "Objective target") as null|anything in possible_targets + new_objective = new /datum/objective/destroy + new_objective.target = new_target.mind + new_objective.owner = src + new_objective.explanation_text = "Destroy [new_target.name], the experimental AI." + else + usr << "No active AIs with minds" + if ("speciesist") new_objective = new /datum/objective/speciesist new_objective.owner = src diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 0743172bd54..f788b8145e8 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -106,34 +106,41 @@ assign_exchange_role(exchange_red) assign_exchange_role(exchange_blue) else - switch(rand(1,100)) - if(1 to 30) - var/datum/objective/assassinate/kill_objective = new - kill_objective.owner = traitor - kill_objective.find_target() - traitor.objectives += kill_objective - if(31 to 40) - var/datum/objective/debrain/debrain_objective = new - debrain_objective.owner = traitor - debrain_objective.find_target() - traitor.objectives += debrain_objective - if(41 to 50) - var/datum/objective/protect/protect_objective = new - protect_objective.owner = traitor - protect_objective.find_target_with_special_role(null,0) - if (!protect_objective.target) - protect_objective.find_target() //We could not find any traitors, protect somebody - traitor.objectives += protect_objective - if(51 to 66) - var/datum/objective/harm/harm_objective = new - harm_objective.owner = traitor - harm_objective.find_target() - traitor.objectives += harm_objective - else - var/datum/objective/steal/steal_objective = new - steal_objective.owner = traitor - steal_objective.find_target() - traitor.objectives += steal_objective + var/list/active_ais = active_ais() + if(active_ais.len && prob(100/num_players())) + var/datum/objective/destroy/destroy_objective = new + destroy_objective.owner = traitor + destroy_objective.find_target() + traitor.objectives += destroy_objective + else + switch(rand(1,100)) + if(1 to 30) + var/datum/objective/assassinate/kill_objective = new + kill_objective.owner = traitor + kill_objective.find_target() + traitor.objectives += kill_objective + if(31 to 40) + var/datum/objective/debrain/debrain_objective = new + debrain_objective.owner = traitor + debrain_objective.find_target() + traitor.objectives += debrain_objective + if(41 to 50) + var/datum/objective/protect/protect_objective = new + protect_objective.owner = traitor + protect_objective.find_target_with_special_role(null,0) + if (!protect_objective.target) + protect_objective.find_target() //We could not find any traitors, protect somebody + traitor.objectives += protect_objective + if(51 to 61) + var/datum/objective/harm/harm_objective = new + harm_objective.owner = traitor + harm_objective.find_target() + traitor.objectives += harm_objective + else + var/datum/objective/steal/steal_objective = new + steal_objective.owner = traitor + steal_objective.find_target() + traitor.objectives += steal_objective switch(rand(1,100)) if(1 to 30) // Die glorious death if (!(locate(/datum/objective/die) in traitor.objectives) && !(locate(/datum/objective/steal) in traitor.objectives))