From 7b02a11dc29658d6ea0c14d2a09ecbdcbb6edba0 Mon Sep 17 00:00:00 2001 From: Ikarrus Date: Sat, 25 Apr 2015 01:20:04 -0600 Subject: [PATCH] Gang Update 5 ###Major Changes### - Influence income changed to provide weaker gangs a bigger boost, while slowing down stronger gangs to promote opportunity for comebacks - Gangs only earn influence on territories they have held on to since the previous Status Report (the income calculation every 5 minutes). This places more significance on defending your existing territory. - Victory conditions are only checked during Status Reports. - Bosses no longer receive territory updates real-time. They now get them all as a list of new and lost territories in the Status Update. ###Minor Changes### - Goal is now a coeff var so it can be modified in-game for debugging/playtesting purposes - Simplified some list checks for gang - Trying to tag an invalid area will just error out and return, instead of the ganger spraying regular grafiti and confusing people --- code/game/gamemodes/gang/gang.dm | 130 +++++++++++++----- code/game/objects/effects/decals/crayon.dm | 24 ++-- code/game/objects/items/devices/recaller.dm | 19 +-- code/game/objects/items/toys.dm | 33 +++-- .../objects/items/weapons/implants/implant.dm | 4 +- 5 files changed, 133 insertions(+), 77 deletions(-) diff --git a/code/game/gamemodes/gang/gang.dm b/code/game/gamemodes/gang/gang.dm index cfd7f03d89c..15d91bc02a8 100644 --- a/code/game/gamemodes/gang/gang.dm +++ b/code/game/gamemodes/gang/gang.dm @@ -11,6 +11,10 @@ var/datum/gang_points/gang_points var/list/A_territory = list() var/list/B_territory = list() + var/list/A_territory_new = list() + var/list/A_territory_lost = list() + var/list/B_territory_new = list() + var/list/B_territory_lost = list() /datum/game_mode/gang name = "gang war" @@ -21,15 +25,15 @@ required_enemies = 2 recommended_enemies = 2 enemy_minimum_age = 14 - var/finished = 0 - var/checkwin_counter = 0 + var/goal_coeff = 3 //Goal = Total territories / goal_coeff + /////////////////////////// //Announces the game type// /////////////////////////// /datum/game_mode/gang/announce() world << "The current game mode is - Gang War!" - world << "A violent turf war has erupted on the station!
Gangsters - Take over the station by claiming more than 66% of the station!
Crew - The gangs will try to keep you on the station. Successfully evacuate the station to win!
" + world << "A violent turf war has erupted on the station!
Gangsters - Take over the station by claiming more than [round(100/goal_coeff,1)]% of the station!
Crew - The gangs will try to keep you on the station. Successfully evacuate the station to win!
" /////////////////////////////////////////////////////////////////////////////// @@ -74,15 +78,6 @@ modePlayer += B_bosses ..() - -/datum/game_mode/gang/process() - checkwin_counter++ - if(checkwin_counter >= 5) - if(!finished) - ticker.mode.check_win() - checkwin_counter = 0 - return 0 - /datum/game_mode/gang/proc/assign_bosses() var/datum/mind/boss = pick(antag_candidates) A_bosses += boss @@ -99,7 +94,7 @@ /datum/game_mode/proc/forge_gang_objectives(var/datum/mind/boss_mind) var/datum/objective/rival_obj = new rival_obj.owner = boss_mind - rival_obj.explanation_text = "Claim more than 66% the station before the [(boss_mind in A_bosses) ? gang_name("B") : gang_name("A")] Gang does." + rival_obj.explanation_text = "Claim more than [round(100/goal_coeff,1)]% the station before the [(boss_mind in A_bosses) ? gang_name("B") : gang_name("A")] Gang does." boss_mind.objectives += rival_obj @@ -167,9 +162,9 @@ //Checks if the either gang have won or not// ///////////////////////////////////////////// /datum/game_mode/gang/check_win() - if(A_territory.len > (start_state.num_territories / 3)) + if(A_territory.len > (start_state.num_territories / goal_coeff)) finished = "A" //Gang A wins - else if(B_territory.len > (start_state.num_territories / 3)) + else if(B_territory.len > (start_state.num_territories / goal_coeff)) finished = "B" //Gang B wins /////////////////////////////// @@ -186,7 +181,7 @@ /datum/game_mode/proc/add_gangster(datum/mind/gangster_mind, var/gang, var/check = 1) if(check && isloyal(gangster_mind.current)) //Check to see if the potential gangster is implanted return 0 - if((gangster_mind in A_bosses) || (gangster_mind in A_gang) || (gangster_mind in B_bosses) || (gangster_mind in B_gang)) + if(gangster_mind in (A_bosses | A_gang | B_bosses | B_gang)) return 0 if(gang == "A") A_gang += gangster_mind @@ -341,9 +336,9 @@ world << text -////////////////////////////////// -//Handles gang points and income// -////////////////////////////////// +////////////////////////////////////////////////////////// +//Handles influence, territories, and the victory checks// +////////////////////////////////////////////////////////// /datum/gang_points var/A = 30 @@ -356,24 +351,94 @@ income() /datum/gang_points/proc/income() - var/A_new = min(100,(A + 10 + min(ticker.mode.A_territory.len,40))) + var/A_added_names = "" + var/B_added_names = "" + var/A_lost_names = "" + var/B_lost_names = "" + + //Process lost territories + for(var/area in ticker.mode.A_territory_lost) + if(A_lost_names == "") + A_lost_names += ":
" + else + A_lost_names += ", " + A_lost_names += "[ticker.mode.A_territory_lost[area]], " + ticker.mode.A_territory -= area + + for(var/area in ticker.mode.B_territory_lost) + if(B_lost_names == "") + B_lost_names += ":
" + else + B_lost_names += ", " + B_lost_names += "[ticker.mode.B_territory_lost[area]], " + ticker.mode.B_territory -= area + + //Calculate and report influence growth + ticker.mode.message_gangtools(ticker.mode.A_tools,"[gang_name("A")] Gang Status Report:") + var/A_new = min(100,A + 15 + min(ticker.mode.A_territory.len, 15) + round(max(ticker.mode.A_territory.len - 15, 0) * 0.5,1)) var/A_message = "" if(A_new != A) - A_message += "Your gang has gained [A_new - A] Influence from their control of [round((ticker.mode.A_territory.len/start_state.num_territories)*100, 1)]% of the station." + A_message += "Your gang has gained [A_new - A] Influence for holding on to [ticker.mode.A_territory.len] territories." if(A_new == 100) A_message += "Maximum influence reached." A = A_new - ticker.mode.message_gangtools(ticker.mode.A_tools,A_message) + ticker.mode.message_gangtools(ticker.mode.A_tools,A_message,0) - var/B_new = min(100,(B + 10 + min(ticker.mode.B_territory.len,40))) + ticker.mode.message_gangtools(ticker.mode.B_tools,"[gang_name("B")] Gang Status Report:") + var/B_new = min(100,B + 15 + min(ticker.mode.B_territory.len, 15) + round(max(ticker.mode.B_territory.len - 15, 0) * 0.5,1)) var/B_message = "" if(B_new != B) - B_message += "Your gang has collected [B_new - B] Influence from their control of [round((ticker.mode.B_territory.len/start_state.num_territories)*100, 1)]% of the station." + B_message += "Your gang has gained [B_new - B] Influence for holding on to [ticker.mode.B_territory.len] territories." if(B_new == 100) B_message += "Maximum influence reached." B = B_new - ticker.mode.message_gangtools(ticker.mode.B_tools,B_message) + ticker.mode.message_gangtools(ticker.mode.B_tools,B_message,0) + + //Remove territories they already own from the buffer, so if they got tagged over, they can still earn income if they tag it back before the next status report + ticker.mode.A_territory_new -= ticker.mode.A_territory + ticker.mode.B_territory_new -= ticker.mode.B_territory + + //Process new territories + for(var/area in ticker.mode.A_territory_new) + if(A_added_names == "") + A_added_names += ":
" + else + A_added_names += ", " + A_added_names += "[ticker.mode.A_territory_new[area]]" + ticker.mode.A_territory += area + + for(var/area in ticker.mode.B_territory_new) + if(B_added_names == "") + B_added_names += ":
" + else + B_added_names += ", " + B_added_names += "[ticker.mode.B_territory_new[area]]" + ticker.mode.B_territory += area + + //Report territory changes + ticker.mode.message_gangtools(ticker.mode.A_tools,"[ticker.mode.A_territory_new.len] new territories[A_added_names]",0) + ticker.mode.message_gangtools(ticker.mode.B_tools,"[ticker.mode.B_territory_new.len] new territories[B_added_names]",0,) + ticker.mode.message_gangtools(ticker.mode.A_tools,"[ticker.mode.A_territory_lost.len] territories lost[A_lost_names]",0,1) + ticker.mode.message_gangtools(ticker.mode.B_tools,"[ticker.mode.B_territory_lost.len] territories lost[B_lost_names]",0,1) + + //Clear the lists + ticker.mode.A_territory_new = list() + ticker.mode.B_territory_new = list() + ticker.mode.A_territory_lost = list() + ticker.mode.B_territory_lost = list() + + var/A_control = round((ticker.mode.A_territory.len/start_state.num_territories)*100, 1) + var/B_control = round((ticker.mode.B_territory.len/start_state.num_territories)*100, 1) + ticker.mode.message_gangtools((ticker.mode.A_tools),"Your gang now has [A_control]% control of the station.",0) + ticker.mode.message_gangtools((ticker.mode.A_tools),"The [gang_name("B")] Gang has [B_control]% control of the station.",0,1) + ticker.mode.message_gangtools((ticker.mode.B_tools),"Your gang now has [B_control]% control of the station.",0) + ticker.mode.message_gangtools((ticker.mode.B_tools),"The [gang_name("A")] Gang has [A_control]% control of the station.",0,1) + + //Victory check + ticker.mode.check_win() + + //Restart the counter start() @@ -381,14 +446,13 @@ //Sends a message to the boss via his gangtool// //////////////////////////////////////////////// -/datum/game_mode/proc/message_gangtools(var/list/gangtools,var/message,var/priority=2) //0 Territories Gained | 1 Territories lost | 2 Beep! +/datum/game_mode/proc/message_gangtools(var/list/gangtools,var/message,var/beep=1,var/warning) if(!gangtools.len || !message) return for(var/obj/item/device/gangtool/tool in gangtools) - if(tool.ignore_messages <= priority) - var/mob/living/mob = get(tool.loc,/mob/living) - if(mob && mob.mind) - if(((tool.gang == "A") && ((mob.mind in A_gang) || (mob.mind in A_bosses))) || ((tool.gang == "B") && ((mob.mind in B_gang) || (mob.mind in B_bosses)))) - mob << "\icon[tool] [message]" - if(priority>=2) - playsound(mob.loc, 'sound/machines/twobeep.ogg', 50, 1) \ No newline at end of file + var/mob/living/mob = get(tool.loc,/mob/living) + if(mob && mob.mind) + if(((tool.gang == "A") && ((mob.mind in A_gang) || (mob.mind in A_bosses))) || ((tool.gang == "B") && ((mob.mind in B_gang) || (mob.mind in B_bosses)))) + mob << "\icon[tool] [message]" + if(beep) + playsound(mob.loc, 'sound/machines/twobeep.ogg', 50, 1) \ No newline at end of file diff --git a/code/game/objects/effects/decals/crayon.dm b/code/game/objects/effects/decals/crayon.dm index 424467798e9..0274f24aa21 100644 --- a/code/game/objects/effects/decals/crayon.dm +++ b/code/game/objects/effects/decals/crayon.dm @@ -35,38 +35,30 @@ qdel(src) var/area/territory = get_area(location) - var/list/recipients = list() var/color if(type == "A") gang = type color = "#00b4ff" icon_state = gang_name("A") - recipients = ticker.mode.A_tools - ticker.mode.A_territory |= territory.type + ticker.mode.A_territory_new |= list(territory.type = territory.name) + ticker.mode.A_territory_lost -= territory.type else if(type == "B") gang = type color = "#ff3232" icon_state = gang_name("B") - recipients = ticker.mode.B_tools - ticker.mode.B_territory |= territory.type - - if(recipients.len) - ticker.mode.message_gangtools(recipients,"New territory claimed: [territory]",0) + ticker.mode.B_territory_new |= list(territory.type = territory.name) + ticker.mode.B_territory_lost -= territory.type ..(location, color, icon_state, e_name, rotation) /obj/effect/decal/cleanable/crayon/gang/Destroy() var/area/territory = get_area(src) - var/list/recipients = list() if(gang == "A") - recipients += ticker.mode.A_tools - ticker.mode.A_territory -= territory.type + ticker.mode.A_territory_new -= territory.type + ticker.mode.A_territory_lost |= list(territory.type = territory.name) if(gang == "B") - recipients += ticker.mode.B_tools - ticker.mode.B_territory -= territory.type - if(recipients.len) - ticker.mode.message_gangtools(recipients,"Territory lost: [territory]",1) - + ticker.mode.B_territory_new -= territory.type + ticker.mode.B_territory_lost |= list(territory.type = territory.name) ..() \ No newline at end of file diff --git a/code/game/objects/items/devices/recaller.dm b/code/game/objects/items/devices/recaller.dm index f1f7e30e92f..ed4750d62fa 100644 --- a/code/game/objects/items/devices/recaller.dm +++ b/code/game/objects/items/devices/recaller.dm @@ -12,7 +12,6 @@ var/gang //Which gang uses this? var/boss = 1 //If it has the power to promote gang members var/recalling = 0 - var/ignore_messages = 0 var/promotion_cost = 20 /obj/item/device/gangtool/New() //Initialize supply point income if it hasn't already been started @@ -29,7 +28,7 @@ var/dat if(!gang) dat += "This device is not registered.
" - if((user.mind in ticker.mode.B_bosses) || (user.mind in ticker.mode.A_bosses)) + if(user.mind in (ticker.mode.A_bosses | ticker.mode.B_bosses)) dat += "Give this device to another member of your organization to use.
" else dat += "Register Device
" @@ -40,13 +39,7 @@ dat += "Registration: [(gang == "A")? gang_name("A") : gang_name("B")] Gang [boss ? "Administrator" : "Member"]
" dat += "Organization Size: [gang_size]
" - dat += "Territories Controlled: [round((gang_territory/start_state.num_territories)*100, 1)]% of [station_name()]
" - var/alert = "Recieve all alerts" - if(ignore_messages == 1) - alert = "Ignore territories gained" - else if(ignore_messages == 2) - alert = "Ignore territories gained and lost" - dat += "Message Setting: [alert]
" + dat += "Station Control: [round((gang_territory/start_state.num_territories)*100, 1)]%
" dat += "Recall Emergency Shuttle
" dat += "
" dat += "Influence: [points]
" @@ -142,10 +135,6 @@ else if(href_list["choice"]) switch(href_list["choice"]) - if("ignore") - ignore_messages++ - if(ignore_messages>2) - ignore_messages = 0 if("recall") recall(usr) if("register") @@ -155,7 +144,7 @@ /obj/item/device/gangtool/proc/register_device(var/mob/user) var/promoted - if((user.mind in ticker.mode.A_gang) || (user.mind in ticker.mode.A_bosses)) + if(user.mind in (ticker.mode.A_gang | ticker.mode.A_bosses)) ticker.mode.A_tools += src gang = "A" if(!(user.mind in ticker.mode.A_bosses)) @@ -165,7 +154,7 @@ ticker.mode.update_gang_icons_added(user.mind, "A") log_game("[key_name(user)] has been promoted to Lieutenant in the [gang_name("A")] Gang (A)") promoted = 1 - else if((user.mind in ticker.mode.B_gang) || (user.mind in ticker.mode.B_bosses)) + else if(user.mind in (ticker.mode.B_gang | ticker.mode.B_bosses)) ticker.mode.B_tools += src gang = "B" if(!(user.mind in ticker.mode.B_bosses)) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 6c7524e0089..4e44a4c0b7b 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -413,22 +413,33 @@ var/gangID if(gang) //Determine gang affiliation - if((user.mind in ticker.mode.A_bosses) || (user.mind in ticker.mode.A_gang)) + if(user.mind in (ticker.mode.A_bosses | ticker.mode.A_gang)) temp = "[gang_name("A")] gang tag" gangID = "A" - else if((user.mind in ticker.mode.B_bosses) || (user.mind in ticker.mode.B_gang)) + else if(user.mind in (ticker.mode.B_bosses | ticker.mode.B_gang)) temp = "[gang_name("B")] gang tag" gangID = "B" //Check area validity. Reject space, player-created areas, and non-station z-levels. - territory = get_area(target) - if (gangID && territory && (territory.z == ZLEVEL_STATION) && territory.valid_territory) - //Check if this area is already tagged by a gang - if(!(locate(/obj/effect/decal/cleanable/crayon/gang) in target)) //Ignore the check if the tile being sprayed has a gang tag - if(territory_claimed(territory, user)) + if (gangID) + var/area/user_area = get_area(user.loc) + territory = get_area(target) + if(territory && (territory.z == ZLEVEL_STATION) && territory.valid_territory) + //Prevent people spraying from outside of the territory (ie. Maint walls) + if(istype(user_area) && (user_area.type == territory.type)) + //Check if this area is already tagged by a gang + if(!(locate(/obj/effect/decal/cleanable/crayon/gang) in target)) //Ignore the check if the tile being sprayed has a gang tag + if(territory_claimed(territory, user)) + return + if((locate(/obj/machinery/power/terminal) in target) || (locate(/obj/machinery/power/terminal) in user.loc)) + user << "You cannot tag here." + return + else + user << "You cannot tag [territory] from the outside." return - else - user << "This area is unsuitable for territory tagging!" + else + user << "[territory] is unsuitable for territory tagging." + return ///////////////////////////////////////// var/graf_rot @@ -486,9 +497,9 @@ /obj/item/toy/crayon/proc/territory_claimed(var/area/territory,mob/user) var/occupying_gang - if(territory.type in ticker.mode.A_territory) + if(territory.type in (ticker.mode.A_territory | ticker.mode.A_territory_new)) occupying_gang = gang_name("A") - if(territory.type in ticker.mode.B_territory) + if(territory.type in (ticker.mode.B_territory | ticker.mode.B_territory_new)) occupying_gang = gang_name("B") if(occupying_gang) user << "[territory] has already been tagged by the [occupying_gang] gang! You must get rid of or spray over the old tag first!" diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index bedf0ebe085..ede7ae576c6 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -173,10 +173,10 @@ /obj/item/weapon/implant/loyalty/implanted(mob/target) ..() - if((target.mind in ticker.mode.head_revolutionaries) || (target.mind in ticker.mode.A_bosses) || (target.mind in ticker.mode.B_bosses) || is_shadow_or_thrall(target)) + if((target.mind in (ticker.mode.head_revolutionaries | ticker.mode.A_bosses | ticker.mode.B_bosses)) || is_shadow_or_thrall(target)) target.visible_message("[target] seems to resist the implant!", "You feel the corporate tendrils of Nanotrasen try to invade your mind!") return 0 - if((target.mind in ticker.mode.revolutionaries) || (target.mind in ticker.mode.A_gang) || (target.mind in ticker.mode.B_gang)) + if(target.mind in (ticker.mode.revolutionaries | ticker.mode.A_gang | ticker.mode.B_gang)) ticker.mode.remove_revolutionary(target.mind) ticker.mode.remove_gangster(target.mind, exclude_bosses=0) target << "You feel a surge of loyalty towards Nanotrasen."