/datum/game_mode/var/list/datum/mind/ninjas = list()
// Keep in mind ninja-procs that aren't here will be where the event's defined
/datum/game_mode/ninja
name = "ninja"
config_tag = "ninja"
required_players = 10 //Can be adjusted later, should suffice for now.
required_players_secret = 10
required_enemies = 1
recommended_enemies = 1
var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
var/finished = 0
/datum/game_mode/ninja/announce()
world << "The current game mode is Ninja!"
/datum/game_mode/ninja/can_start()
if(!..())
return 0
var/list/datum/mind/possible_ninjas = get_players_for_role(BE_NINJA)
if(possible_ninjas.len==0)
return 0
var/datum/mind/ninja = pick(possible_ninjas)
ninjas += ninja
modePlayer += ninja
ninja.assigned_role = "MODE" //So they aren't chosen for other jobs.
ninja.special_role = "Ninja"
ninja.original = ninja.current
/*if(ninjastart.len == 0)
ninja.current << "\red A proper starting location for you could not be found, please report this bug!"
ninja.current << "\red Attempting to place at a carpspawn."*/
//Until such a time as people want to place ninja spawn points, carpspawn will do fine.
for(var/obj/effect/landmark/L in landmarks_list)
if(L.name == "carpspawn")
ninjastart.Add(L)
if(ninjastart.len == 0 && latejoin.len > 0)
ninja.current << "\red No spawneable locations could be found. Defaulting to latejoin."
return 1
else if (ninjastart.len == 0)
ninja.current << "\red No spawneable locations could be found. Aborting."
return 0
return 1
/datum/game_mode/ninja/pre_setup()
for(var/datum/mind/ninja in ninjas)
ninja.current << browse(null, "window=playersetup")
ninja.current = create_space_ninja(pick(ninjastart.len ? ninjastart : latejoin))
ninja.current.ckey = ninja.key
return 1
/datum/game_mode/ninja/post_setup()
for(var/datum/mind/ninja in ninjas)
if(ninja.current && !(istype(ninja.current,/mob/living/carbon/human))) return 0
if(!config.objectives_disabled)
forge_ninja_objectives(ninja)
show_objectives(ninja)
var/mob/living/carbon/human/N = ninja.current
N.internal = N.s_store
N.internals.icon_state = "internal1"
spawn (rand(waittime_l, waittime_h))
send_intercept()
return ..()
/datum/game_mode/ninja/check_finished()
if(config.continous_rounds)
return ..()
var/ninjas_alive = 0
for(var/datum/mind/ninja in ninjas)
if(!istype(ninja.current,/mob/living/carbon/human))
continue
if(ninja.current.stat==2)
continue
ninjas_alive++
if (ninjas_alive)
return ..()
else
finished = 1
return 1
/datum/game_mode/ninja/proc/forge_ninja_objectives(var/datum/mind/ninja)
if (config.objectives_disabled)
return
var/objective_list = list(1,2,3,4,5)
for(var/i=rand(2,4),i>0,i--)
switch(pick(objective_list))
if(1)//Kill
var/datum/objective/assassinate/ninja_objective = new
ninja_objective.owner = ninja
ninja_objective.target = ninja_objective.find_target()
if(ninja_objective.target != "Free Objective")
ninja.objectives += ninja_objective
else
i++
objective_list -= 1 // No more than one kill objective
if(2)//Steal
var/datum/objective/steal/ninja_objective = new
ninja_objective.owner = ninja
ninja_objective.target = ninja_objective.find_target()
ninja.objectives += ninja_objective
if(3)//Protect
var/datum/objective/protect/ninja_objective = new
ninja_objective.owner = ninja
ninja_objective.target = ninja_objective.find_target()
if(ninja_objective.target != "Free Objective")
ninja.objectives += ninja_objective
else
i++
objective_list -= 3
if(4)//Download
var/datum/objective/download/ninja_objective = new
ninja_objective.owner = ninja
ninja_objective.gen_amount_goal()
ninja.objectives += ninja_objective
objective_list -= 4
if(5)//Harm
var/datum/objective/harm/ninja_objective = new
ninja_objective.owner = ninja
ninja_objective.target = ninja_objective.find_target()
if(ninja_objective.target != "Free Objective")
ninja.objectives += ninja_objective
else
i++
objective_list -= 5
var/datum/objective/survive/ninja_objective = new
ninja_objective.owner = ninja
ninja.objectives += ninja_objective
ninja.current.mind = ninja
var/directive = generate_ninja_directive("heel")//Only hired by antags, not NT
ninja.current << "You are an elite mercenary assassin of the Spider Clan, [ninja.current.real_name]. You have a variety of abilities at your disposal, thanks to your nano-enhanced cyber armor.\nYour current directive is: \red [directive]\n \blue Try your best to adhere to this."
ninja.store_memory("Directive: \red [directive]
")
show_objectives(ninja)
/datum/game_mode/proc/auto_declare_completion_ninja()
if(ninjas.len)
var/text = "The ninjas were:"
for(var/datum/mind/ninja in ninjas)
var/ninjawin = 1
text += "
[ninja.key] was [ninja.name] ("
if(ninja.current)
if(ninja.current.stat == DEAD)
text += "died"
else
text += "survived"
if(ninja.current.real_name != ninja.name)
text += " as [ninja.current.real_name]"
else
text += "body destroyed"
text += ")"
if(ninja.objectives.len)//If the ninja had no objectives, don't need to process this.
var/count = 1
for(var/datum/objective/objective in ninja.objectives)
if(objective.check_completion())
text += "
Objective #[count]: [objective.explanation_text] Success!"
feedback_add_details("traitor_objective","[objective.type]|SUCCESS")
else
text += "
Objective #[count]: [objective.explanation_text] Fail."
feedback_add_details("traitor_objective","[objective.type]|FAIL")
ninjawin = 0
count++
var/special_role_text
if(ninja.special_role)
special_role_text = lowertext(ninja.special_role)
else
special_role_text = "antagonist"
if(!config.objectives_disabled)
if(ninjawin)
text += "
The [special_role_text] was successful!"
feedback_add_details("traitor_success","SUCCESS")
else
text += "
The [special_role_text] has failed!"
feedback_add_details("traitor_success","FAIL")
world << text
return 1