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
This commit is contained in:
Ikarrus
2015-04-25 01:20:04 -06:00
parent 8e8561eb3e
commit 7b02a11dc2
5 changed files with 133 additions and 77 deletions
+97 -33
View File
@@ -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 << "<B>The current game mode is - Gang War!</B>"
world << "<B>A violent turf war has erupted on the station!<BR>Gangsters - Take over the station by claiming more than 66% of the station! <BR>Crew - The gangs will try to keep you on the station. Successfully evacuate the station to win!</B>"
world << "<B>A violent turf war has erupted on the station!<BR>Gangsters - Take over the station by claiming more than [round(100/goal_coeff,1)]% of the station! <BR>Crew - The gangs will try to keep you on the station. Successfully evacuate the station to win!</B>"
///////////////////////////////////////////////////////////////////////////////
@@ -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 += ":<br>"
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 += ":<br>"
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,"<b>[gang_name("A")] Gang Status Report:</b>")
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 <b>[A_new - A] Influence</b> 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,"<b>[gang_name("B")] Gang Status Report:</b>")
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>[B_new - B] Influence</b> 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 += ":<br>"
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 += ":<br>"
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,"<b>[ticker.mode.A_territory_new.len] new territories</b>[A_added_names]",0)
ticker.mode.message_gangtools(ticker.mode.B_tools,"<b>[ticker.mode.B_territory_new.len] new territories</b>[B_added_names]",0,)
ticker.mode.message_gangtools(ticker.mode.A_tools,"<b>[ticker.mode.A_territory_lost.len] territories lost</b>[A_lost_names]",0,1)
ticker.mode.message_gangtools(ticker.mode.B_tools,"<b>[ticker.mode.B_territory_lost.len] territories lost</b>[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 <b>[A_control]% control</b> of the station.",0)
ticker.mode.message_gangtools((ticker.mode.A_tools),"The [gang_name("B")] Gang has <b>[B_control]% control</b> of the station.",0,1)
ticker.mode.message_gangtools((ticker.mode.B_tools),"Your gang now has <b>[B_control]% control</b> of the station.",0)
ticker.mode.message_gangtools((ticker.mode.B_tools),"The [gang_name("A")] Gang has <b>[A_control]% control</b> 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 << "<span class='notice'>\icon[tool] [message]</span>"
if(priority>=2)
playsound(mob.loc, 'sound/machines/twobeep.ogg', 50, 1)
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 << "<span class='[warning ? "warning" : "notice"]'>\icon[tool] [message]</span>"
if(beep)
playsound(mob.loc, 'sound/machines/twobeep.ogg', 50, 1)
+8 -16
View File
@@ -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)
..()
+4 -15
View File
@@ -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.<br>"
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.<br>"
else
dat += "<a href='?src=\ref[src];choice=register'>Register Device</a><br>"
@@ -40,13 +39,7 @@
dat += "Registration: <B>[(gang == "A")? gang_name("A") : gang_name("B")] Gang [boss ? "Administrator" : "Member"]</B><br>"
dat += "Organization Size: <B>[gang_size]</B><br>"
dat += "Territories Controlled: <B>[round((gang_territory/start_state.num_territories)*100, 1)]% of [station_name()]</B><br>"
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: <a href='?src=\ref[src];choice=ignore'>[alert]</a><br>"
dat += "Station Control: <B>[round((gang_territory/start_state.num_territories)*100, 1)]%</B><br>"
dat += "<a href='?src=\ref[src];choice=recall'>Recall Emergency Shuttle</a><br>"
dat += "<br>"
dat += "Influence: <B>[points]</B><br>"
@@ -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))
+22 -11
View File
@@ -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 << "<span class='warning'>You cannot tag here.</span>"
return
else
user << "<span class='warning'>You cannot tag [territory] from the outside.</span>"
return
else
user << "<span class='warning'>This area is unsuitable for territory tagging!</span>"
else
user << "<span class='warning'>[territory] is unsuitable for territory tagging.</span>"
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 << "<span class='danger'>[territory] has already been tagged by the [occupying_gang] gang! You must get rid of or spray over the old tag first!</span>"
@@ -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("<span class='warning'>[target] seems to resist the implant!</span>", "<span class='warning'>You feel the corporate tendrils of Nanotrasen try to invade your mind!</span>")
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 << "<span class='notice'>You feel a surge of loyalty towards Nanotrasen.</span>"