From 7dbd45857a770050523b3e1a5d76c367d37fb4b0 Mon Sep 17 00:00:00 2001 From: Markolie Date: Sun, 26 Jul 2015 06:06:04 +0200 Subject: [PATCH] Fix cult sacrifice objective --- code/datums/mind.dm | 4 ++-- code/game/gamemodes/cult/cult.dm | 38 ++++++++++++++++++++------------ code/game/gamemodes/objective.dm | 23 ++++++++++++------- 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 9799cd2caf5..853191a4d7d 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -650,7 +650,7 @@ datum/mind special_role = null var/datum/game_mode/cult/cult = ticker.mode if (istype(cult)) - cult.memoize_cult_objectives(src) + cult.memorize_cult_objectives(src) current << "\red The nanobots in the loyalty implant remove all thoughts about being in a cult. Have a productive day!" memory = "" if(src in ticker.mode.traitors) @@ -1239,7 +1239,7 @@ datum/mind current << "Assist your new compatriots in their dark dealings. Their goal is yours, and yours is theirs. You serve the Dark One above all else. Bring It back." var/datum/game_mode/cult/cult = ticker.mode if (istype(cult)) - cult.memoize_cult_objectives(src) + cult.memorize_cult_objectives(src) else var/explanation = "Summon Nar-Sie via the use of the appropriate rune (Hell join self). It will only work if nine cultists stand on and around it." current << "Objective #1: [explanation]" diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 392441428d1..6968ea48c1b 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -10,10 +10,17 @@ /proc/is_convertable_to_cult(datum/mind/mind) - if(!istype(mind)) return 0 - if(istype(mind.current, /mob/living/carbon/human) && (mind.assigned_role in list("Captain", "Chaplain"))) return 0 - for(var/obj/item/weapon/implant/loyalty/L in mind.current) - if(L && (L.imp_in == mind.current))//Checks to see if the person contains an implant, then checks that the implant is actually inside of them + if(!mind) + return 0 + if(!mind.current) + return 0 + if(iscultist(mind.current)) + return 1 //If they're already in the cult, assume they are convertable + if(ishuman(mind.current) && (mind.assigned_role in list("Captain", "Chaplain"))) + return 0 + if(ishuman(mind.current)) + var/mob/living/carbon/human/H = mind.current + if(H.is_loyalty_implanted()) return 0 return 1 @@ -42,7 +49,7 @@ var/eldergod = 1 //for the summon god objective - var/const/acolytes_needed = 5 //for the survive objective + var/acolytes_needed = 4 //for the survive objective - base number of acolytes, increased by 1 for every 10 players var/const/min_cultists_to_start = 3 var/const/max_cultists_to_start = 4 var/acolytes_survived = 0 @@ -54,7 +61,7 @@ /datum/game_mode/cult/pre_setup() - if(prob(50)) + if(prob(50)) objectives += "survive" objectives += "sacrifice" else @@ -79,23 +86,26 @@ /datum/game_mode/cult/post_setup() modePlayer += cult + acolytes_needed = acolytes_needed + round((num_players_started() / 10)) if("sacrifice" in objectives) var/list/possible_targets = get_unconvertables() - if(!possible_targets.len) for(var/mob/living/carbon/human/player in player_list) if(player.mind && !(player.mind in cult)) possible_targets += player.mind - if(possible_targets.len > 0) sacrifice_target = pick(possible_targets) + else + objectives -= "sacrifice" + objectives |= "survive" + objectives |= "eldergod" for(var/datum/mind/cult_mind in cult) equip_cultist(cult_mind.current) grant_runeword(cult_mind.current) update_cult_icons_added(cult_mind) cult_mind.current << "\blue You are a member of the cult!" - memoize_cult_objectives(cult_mind) + memorize_cult_objectives(cult_mind) cult_mind.special_role = "Cultist" spawn (rand(waittime_l, waittime_h)) @@ -103,7 +113,7 @@ ..() -/datum/game_mode/cult/proc/memoize_cult_objectives(var/datum/mind/cult_mind) +/datum/game_mode/cult/proc/memorize_cult_objectives(var/datum/mind/cult_mind) for(var/obj_count = 1,obj_count <= objectives.len,obj_count++) var/explanation switch(objectives[obj_count]) @@ -111,7 +121,7 @@ explanation = "Our knowledge must live on. Make sure at least [acolytes_needed] acolytes escape on the shuttle to spread their work on an another station." if("sacrifice") if(sacrifice_target) - explanation = "Sacrifice [sacrifice_target.name], the [sacrifice_target.assigned_role]. You will need the sacrifice rune (Hell blood join) and three acolytes to do so." + explanation = "Sacrifice [sacrifice_target.current.real_name], the [sacrifice_target.assigned_role]. You will need the sacrifice rune (hell blood join) and three acolytes to do so." else explanation = "Free objective." if("eldergod") @@ -189,7 +199,7 @@ /datum/game_mode/cult/add_cultist(datum/mind/cult_mind) //INHERIT if (!..(cult_mind)) return - memoize_cult_objectives(cult_mind) + memorize_cult_objectives(cult_mind) /datum/game_mode/proc/remove_cultist(datum/mind/cult_mind, show_message = 1) @@ -327,7 +337,7 @@ /datum/game_mode/cult/proc/get_unconvertables() var/list/ucs = list() - for(var/mob/living/carbon/human/player in mob_list) + for(var/mob/living/carbon/human/player in player_list) if(!is_convertable_to_cult(player.mind)) ucs += player.mind return ucs @@ -340,7 +350,7 @@ if(objectives.Find("eldergod")) cult_fail += eldergod //1 by default, 0 if the elder god has been summoned at least once if(objectives.Find("sacrifice")) - if(sacrifice_target && !sacrificed.Find(sacrifice_target)) //if the target has been sacrificed, ignore this step. otherwise, add 1 to cult_fail + if(sacrifice_target && !(sacrifice_target in sacrificed)) //if the target has been sacrificed, ignore this step. otherwise, add 1 to cult_fail cult_fail++ return cult_fail //if any objectives aren't met, failure diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index ad9b8390253..a052fcda9c9 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -437,7 +437,7 @@ datum/objective/escape/escape_with_identity target_real_name = target.current.real_name explanation_text = "Escape on the shuttle or an escape pod with the identity of [target_real_name], the [target.assigned_role] while wearing their identification card." else - explanation_text = "Free Objective." + explanation_text = "Free Objective" check_completion() if(!target_real_name) @@ -715,14 +715,15 @@ datum/objective/destroy explanation_text = "Summon Nar-Sie via the use of an appropriate rune. It will only work if nine cultists stand on and around it." check_completion() - if(eldergod) //global var, defined in rune4.dm + if(!eldergod) //global var, defined in rune4.dm return 1 return 0 survivecult var/num_cult - - explanation_text = "Our knowledge must live on. Make sure at least 5 acolytes escape on the shuttle to spread their work on an another station." + var/cult_needed = 4 + round((num_players_started() / 10)) + + explanation_text = "Our knowledge must live on. Make sure at least [cult_needed] acolytes escape on the shuttle to spread their work on an another station." check_completion() if(!emergency_shuttle.returned()) @@ -736,7 +737,7 @@ datum/objective/destroy if(iscultist(H)) cultists_escaped++ - if(cultists_escaped>=5) + if(cultists_escaped >= cult_needed) return 1 return 0 @@ -744,20 +745,26 @@ datum/objective/destroy sacrifice //stolen from traitor target objective proc/find_target() //I don't know how to make it work with the rune otherwise, so I'll do it via a global var, sacrifice_target, defined in rune15.dm - var/list/possible_targets = call(/datum/game_mode/cult/proc/get_unconvertables)() + var/datum/game_mode/cult/C = ticker.mode + var/list/possible_targets = C.get_unconvertables() + + if(!possible_targets.len) + for(var/mob/living/carbon/human/player in player_list) + if(player.mind && !(player.mind in cult)) + possible_targets += player.mind if(possible_targets.len > 0) sacrifice_target = pick(possible_targets) if(sacrifice_target && sacrifice_target.current) - explanation_text = "Sacrifice [sacrifice_target.current.real_name], the [sacrifice_target.assigned_role]. You will need the sacrifice rune (Hell join blood) and three acolytes to do so." + explanation_text = "Sacrifice [sacrifice_target.current.real_name], the [sacrifice_target.assigned_role]. You will need the sacrifice rune (hell join blood) and three acolytes to do so." else explanation_text = "Free Objective" return sacrifice_target check_completion() //again, calling on a global list defined in rune15.dm - if(sacrifice_target.current in sacrificed) + if(sacrifice_target in sacrificed) return 1 else return 0