Merge pull request #600 from Jay-Sparrow/Dynamic2

More dynamic
This commit is contained in:
Dahlular
2020-10-18 13:22:15 -06:00
committed by GitHub
6 changed files with 163 additions and 38 deletions
+15 -13
View File
@@ -351,8 +351,8 @@ GLOBAL_VAR_INIT(dynamic_chaos_level, 1.5)
if (ruleset.weight)
midround_rules += ruleset
if ("Event")
if(ruleset.weight)
event_rules += ruleset
//if(ruleset.weight)
event_rules += ruleset
for(var/mob/dead/new_player/player in GLOB.player_list)
if(player.ready == PLAYER_READY_TO_PLAY && player.mind)
roundstart_pop_ready++
@@ -644,7 +644,7 @@ GLOBAL_VAR_INIT(dynamic_chaos_level, 1.5)
if (prob(get_injection_chance()))
var/list/drafted_rules = list()
for (var/datum/dynamic_ruleset/midround/rule in midround_rules)
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level) && threat >= rule.cost)
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level))
// Classic secret : only autotraitor/minor roles
if (GLOB.dynamic_classic_secret && !((rule.flags & TRAITOR_RULESET) || (rule.flags & MINOR_RULESET)))
continue
@@ -665,10 +665,10 @@ GLOBAL_VAR_INIT(dynamic_chaos_level, 1.5)
update_playercounts()
var/list/drafted_rules = list()
for (var/datum/dynamic_ruleset/event/rule in event_rules)
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level) && threat >= rule.cost)
if (rule.acceptable(current_players[CURRENT_LIVING_PLAYERS].len, threat_level))
// Classic secret : only autotraitor/minor roles
if (!GLOB.master_mode == "dynamic")
continue
//if (!GLOB.master_mode == "dynamic")
//continue
if (world.time < rule.earliest_start)
continue
if(rule.occurances_current >= rule.occurances_max && rule.occurances_max)
@@ -676,8 +676,9 @@ GLOBAL_VAR_INIT(dynamic_chaos_level, 1.5)
rule.candidates = list()
rule.candidates = current_players.Copy()
rule.trim_candidates()
if (rule.ready() && rule.candidates.len > 0)
drafted_rules[rule] = rule.get_weight()
//if(rule.needs_players)
//if (rule.ready() && rule.candidates.len > 0)
drafted_rules[rule] = rule.get_weight()
if(drafted_rules.len > 0)
picking_midround_latejoin_rule(drafted_rules)
@@ -727,13 +728,14 @@ GLOBAL_VAR_INIT(dynamic_chaos_level, 1.5)
chance += 25-10*(max_pop_per_antag-current_pop_per_antag)
*/
//Hyper change - Base injection chance based on chaos.
chance = (GLOB.dynamic_chaos_level * 10) //Base chance from 0 to 50
chance = (GLOB.dynamic_chaos_level * 12) //Base chance from 0 to 60
if (current_players[CURRENT_DEAD_PLAYERS].len > current_players[CURRENT_LIVING_PLAYERS].len)
chance -= 30 // More than half the crew died? ew, let's calm down on antags
if (threat > 70)
chance += 15
if (threat < 30)
chance -= 15
//if (threat > 70)
// chance += 15
//if (threat < 30)
// chance -= 15
chance += ((threat-40)*0.4) //threat influence injection chance more gradually
if (chance > 100) //I don't know what would happen if we returned a probability greater than 100%
return 100 //So I won't
return round(max(0,chance))
@@ -3,9 +3,10 @@
var/typepath // typepath of the event
var/controller //round event controller for the event - Required for certain events dependendant on variables within their controllers
var/triggering
var/earliest_start = 20 MINUTES
var/earliest_start = 20 MINUTES
var/occurances_current = 0 //Don't touch this. Skyrat Change.
var/occurances_max = 0 //Maximum occurances for this event. Set to 0 to allow an infinite amount of this event. Skyrat change.
var/needs_players = FALSE //If an event needs players, living or ghosts, set to TRUE. Bypasses the trim_candidates otherwise
var/restrict_ghost_roles = TRUE
var/required_type = /mob/living/carbon/human
var/list/living_players = list()
@@ -26,7 +27,7 @@
if (M.mind && M.mind.assigned_role && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
job_check++ // Checking for "enemies" (such as sec officers). To be counters, they must either not be candidates to that rule, or have a job that restricts them from it
var/threat = round(mode.threat_level/10)
var/threat = max(min(round(mode.threat_level/10),9),1) //min() to stop index errors at 100 threat //Max to stop breaking at 0 threat.
if (job_check < required_enemies[threat])
return FALSE
return ..()
@@ -420,16 +421,22 @@
/datum/dynamic_ruleset/event/operative
name = "Lone Operative"
controller = /datum/round_event_control/operative
typepath = /datum/round_event/ghost_role/operative
required_enemies = list(0,0,0,0,0,0,0,0,0,0)
weight = 0 //This is changed in nuclearbomb.dm
occurances_max = 1
requirements = list(10,5,0,0,0,0,0,0,0,0) //SECURE THAT DISK
cost = 50
/datum/dynamic_ruleset/event/operative/ready()
/datum/dynamic_ruleset/event/operative/get_weight()
var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control
if(istype(loneop))
weight = loneop.weight //Get the weight whenever it's called.
to_chat(GLOB.admins, "<span class='adminnotice'>Current LoneOP weight [weight]</span>")
else
to_chat(GLOB.admins, "<span class='adminnotice'>LoneOP is fucking broken.</span>")
return weight
//////////////////////////////////////////////
// //
@@ -463,7 +470,7 @@
cost = 4
requirements = list(101,5,5,1,1,1,1,1,1,1)
high_population_requirement = 10
earliest_start = 10 MINUTES
earliest_start = 0 MINUTES
repeatable = TRUE
//property_weights = list("extended" = 1)
occurances_max = 3
@@ -565,7 +572,7 @@
//config_tag = "radiation_storm"
typepath = /datum/round_event/radiation_storm
cost = 3
weight = 3
weight = 2
repeatable_weight_decrease = 2
enemy_roles = list("Chemist","Chief Medical Officer","Geneticist","Medical Doctor","AI","Captain")
required_enemies = list(1,1,1,1,1,1,1,1,1,1)
@@ -715,7 +722,7 @@
weight = 100
repeatable_weight_decrease = 1 //Slightly drop the weight each time it is called to keep the pool from getting too diluted as the round goes on.
repeatable = TRUE
//occurances_max = 20 //Our rounds can go for a WHILE
occurances_max = 200 //Our rounds can go for a WHILE
/datum/dynamic_ruleset/event/disease_outbreak
name = "Disease Outbreak"
@@ -31,8 +31,7 @@
continue // Dead players cannot count as opponents
if (M.mind && M.mind.assigned_role && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
job_check++ // Checking for "enemies" (such as sec officers). To be counters, they must either not be candidates to that rule, or have a job that restricts them from it
var/threat = round(mode.threat_level/10)
var/threat = min(round(mode.threat_level/10),9)
if (job_check < required_enemies[threat])
return FALSE
return ..()
@@ -100,7 +100,7 @@
if (M.mind && M.mind.assigned_role && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
job_check++ // Checking for "enemies" (such as sec officers). To be counters, they must either not be candidates to that rule, or have a job that restricts them from it
var/threat = round(mode.threat_level/10)
var/threat = min(round(mode.threat_level/10),9)
if (job_check < required_enemies[threat])
return FALSE
return TRUE
@@ -258,6 +258,112 @@
return TRUE
//////////////////////////////////////////
// //
// LEWD //
// //
//////////////////////////////////////////
/datum/dynamic_ruleset/midround/autotraitor/lewd
name = "Horny Traitor"
persistent = TRUE
antag_flag = ROLE_LEWD_TRAITOR
antag_datum = /datum/antagonist/traitor/lewd
//minimum_required_age = 7
protected_roles = list("AI","Cyborg")
restricted_roles = list("Cyborg","AI")
required_candidates = 1
weight = 2
cost = 0
requirements = list(10,10,10,10,10,10,10,10,10,10)
high_population_requirement = 10
chaos_min = 0.1
chaos_max = 2.5
admin_required = TRUE
//vars for execution
var/list/mob/living/carbon/human/lewd_candidates = list()
var/list/mob/living/carbon/human/targets = list()
var/numTraitors = 1
/datum/dynamic_ruleset/midround/autotraitor/lewd/acceptable(population = 0, threat = 0) //copy paste to bypass parent
if(minimum_players > population)
return FALSE
if(maximum_players > 0 && population > maximum_players)
return FALSE
if(GLOB.dynamic_chaos_level < chaos_min || GLOB.dynamic_chaos_level > chaos_max)
return FALSE
if(admin_required && !GLOB.admins.len)
return FALSE
if (population >= GLOB.dynamic_high_pop_limit)
return (mode.threat_level >= high_population_requirement)
else
pop_per_requirement = pop_per_requirement > 0 ? pop_per_requirement : mode.pop_per_requirement
var/indice_pop = min(10,round(population/pop_per_requirement)+1)
return (mode.threat_level >= requirements[indice_pop])
/datum/dynamic_ruleset/midround/autotraitor/lewd/trim_candidates()
..()
lewd_candidates = living_players
for(var/mob/living/player in lewd_candidates)
if(issilicon(player)) // Your assigned role doesn't change when you are turned into a silicon.
lewd_candidates -= player
continue
if(is_centcom_level(player.z))
lewd_candidates -= player // We don't autotator people in CentCom
continue
if(player.mind && (player.mind.special_role || player.mind.antag_datums?.len > 0))
lewd_candidates -= player // We don't autotator people with roles already
/datum/dynamic_ruleset/midround/autotraitor/lewd/trim_list(list/L = list())
var/list/trimmed_list = L.Copy()
var/antag_name = initial(antag_flag)
for(var/mob/living/M in trimmed_list)
if (!istype(M, required_type))
trimmed_list.Remove(M)
continue
if (!M.client) // Are they connected?
trimmed_list.Remove(M)
continue
if(!mode.check_age(M.client, minimum_required_age))
trimmed_list.Remove(M)
continue
if (!(antag_name in M.client.prefs.be_special) || jobban_isbanned(M.ckey, list(antag_name, ROLE_SYNDICATE)))//are they willing and not antag-banned?
trimmed_list.Remove(M)
continue
if (M.mind)
if (restrict_ghost_roles && M.mind.assigned_role in GLOB.exp_specialmap[EXP_TYPE_SPECIAL]) // Are they playing a ghost role?
trimmed_list.Remove(M)
continue
if (M.mind.assigned_role in restricted_roles) // All this work to bypass mindshield restriction
trimmed_list.Remove(M)
continue
if ((exclusive_roles.len > 0) && !(M.mind.assigned_role in exclusive_roles)) // Is the rule exclusive to their job?
trimmed_list.Remove(M)
continue
return trimmed_list
/datum/dynamic_ruleset/midround/autotraitor/lewd/ready()
for(var/mob/living/target in living_players)
if(target.client.prefs.noncon)
targets += target
if(lewd_candidates.len)
numTraitors = min(lewd_candidates.len, targets.len, numTraitors)
if(numTraitors == 0)
to_chat(GLOB.admins, "No lewd traitors created. Are there any valid targets?")
return 0
return 1
return 0
/datum/dynamic_ruleset/midround/autotraitor/lewd/execute()
var/mob/M = pick(lewd_candidates)
lewd_candidates -= M
assigned += M.mind
var/datum/antagonist/traitor/lewd/newTraitor = new
M.mind.add_antag_datum(newTraitor)
return TRUE
//////////////////////////////////////////////
// //
// Malfunctioning AI //
@@ -268,7 +374,7 @@
name = "Malfunctioning AI"
antag_datum = /datum/antagonist/traitor
antag_flag = ROLE_MALF
enemy_roles = list("Security Officer", "Warden","Detective","Head of Security", "Captain", "Scientist", "Research Director", "Chief Engineer")
enemy_roles = list("Security Officer", "Warden","Detective","Head of Security", "Captain", "Scientist", "Research Director", "Chief Engineer", "Engineer", "Shaft Miner")
exclusive_roles = list("AI")
required_enemies = list(4,4,4,4,4,4,2,2,2,0)
required_candidates = 1
@@ -61,7 +61,6 @@
mode.picking_specific_rule(/datum/dynamic_ruleset/midround/autotraitor)
*/
/* //Not currently functional
//////////////////////////////////////////
// //
// LEWD //
@@ -77,25 +76,24 @@
protected_roles = list("AI","Cyborg")
restricted_roles = list("Cyborg","AI")
required_candidates = 1
weight = 5
weight = 3
cost = 0
requirements = list(10,10,10,10,10,10,10,10,10,10)
requirements = list(101,10,10,10,10,10,10,10,10,10)
high_population_requirement = 10
chaos_min = 0.1
chaos_max = 2.0
chaos_max = 2.5
admin_required = TRUE
//vars for execution
var/list/mob/living/carbon/human/lewd_candidates = list()
var/numTraitors = 0
var/numTraitors = 1
/datum/dynamic_ruleset/roundstart/traitor/lewd/pre_execute()
/datum/dynamic_ruleset/roundstart/traitor/lewd/ready()
var/list/mob/living/carbon/human/targets = list()
for(var/mob/living/carbon/human/target in GLOB.player_list)
for(var/mob/dead/new_player/target in GLOB.player_list)
if(target.client.prefs.noncon)
if(!(target.job in restricted_roles))
targets += target
targets += target
if(candidates.len)
var/numTraitors = min(candidates.len, targets.len, 1) //This number affects the maximum number of traitors. We want 1 for right now.
@@ -105,14 +103,26 @@
return 1
return 0
/datum/dynamic_ruleset/roundstart/traitor/lewd/pre_execute()
var/traitor_scaling_coeff = 10 - max(0,round(mode.threat_level/10)-5) // Above 50 threat level, coeff goes down by 1 for every 10 levels
var/num_traitors = min(round(mode.candidates.len / traitor_scaling_coeff) + 1, candidates.len)
for (var/i = 1 to num_traitors)
var/mob/M = pick(candidates)
candidates -= M
assigned += M.mind
M.mind.special_role = ROLE_LEWD_TRAITOR
M.mind.restricted_roles = restricted_roles
return TRUE
/*
/datum/dynamic_ruleset/roundstart/traitor/lewd/execute()
var/mob/living/carbon/human/H = null
var/datum/mind/M = null
if(numTraitors)
for(var/i = 0, i<numTraitors, i++)
H = pick(candidates)
candidates.Remove(H)
H.mind.make_LewdTraitor()
M = pick(assigned)
assigned.Remove(M)
M.make_LewdTraitor()
return TRUE
return FALSE
*/
@@ -350,7 +360,7 @@
high_population_requirement = 10
pop_per_requirement = 5
flags = HIGHLANDER_RULESET
var/operative_cap = list(2,2,2,2,2,3,3,3,4,5)
var/operative_cap = list(1,1,1,2,2,3,3,3,4,5)
var/datum/team/nuclear/nuke_team
chaos_min = 4.0
+2 -1
View File
@@ -36,7 +36,6 @@
var/mob/living/carbon/human/H = owner.current
H.set_species(/datum/species/human) //Plasamen burn up otherwise, and lizards are vulnerable to asimov AIs
H.equipOutfit(nukeop_outfit)
H.checkloadappearance()
return TRUE
/datum/antagonist/nukeop/greet()
@@ -53,6 +52,8 @@
memorize_code()
if(send_to_spawnpoint)
move_to_spawnpoint()
var/mob/living/carbon/human/H = owner.current
H.checkloadappearance()
/datum/antagonist/nukeop/get_team()
return nuke_team