Skip to content

Commit

Permalink
Немного разная генерация целек на кражу у некоторых подрядчиков.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorak2024 committed Oct 30, 2024
1 parent 03b8b04 commit a2b97c1
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 58 deletions.
48 changes: 24 additions & 24 deletions code/game/gamemodes/objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@ GLOBAL_LIST_EMPTY(admin_objective_list)
martyr_compatible = FALSE
var/type_theft_flag = THEFT_FLAG_HIGHRISK

/datum/objective/steal/New(text, datum/team/team_to_join)
. = ..()

/datum/objective/steal/proc/get_theft_list_objectives(type_theft_flag)
switch(type_theft_flag)
Expand All @@ -897,36 +899,34 @@ GLOBAL_LIST_EMPTY(admin_objective_list)
else
return GLOB.potential_theft_objectives

/datum/objective/steal/proc/choose_target(target_type, list/target_blacklist = list())
. = FALSE
var/datum/theft_objective/new_theft_objective = new target_type
for(var/datum/mind/player in get_owners())
if((player.assigned_role in new_theft_objective.protected_jobs))
return

/datum/objective/steal/find_target(list/target_blacklist)
var/list/temp = get_theft_list_objectives(type_theft_flag)
var/list/theft_types = temp.Copy()
while(!steal_target && length(theft_types))
var/thefttype = pick_n_take(theft_types)
var/datum/theft_objective/new_theft_objective = new thefttype

var/has_invalid_owner = FALSE
for(var/datum/mind/player in get_owners())
if((player.assigned_role in new_theft_objective.protected_jobs))
has_invalid_owner = TRUE
break

if(has_invalid_owner)
continue
if(!new_theft_objective.check_objective_conditions())
return

if(!new_theft_objective.check_objective_conditions())
continue
if(new_theft_objective.id in target_blacklist)
return

if(new_theft_objective.id in target_blacklist)
continue
steal_target = new_theft_objective
steal_target.generate_explanation_text(src)

steal_target = new_theft_objective
steal_target.generate_explanation_text(src)
if(steal_target.special_equipment)
give_kit(steal_target.special_equipment)

if(steal_target.special_equipment)
give_kit(steal_target.special_equipment)
return TRUE

return TRUE
/datum/objective/steal/find_target(list/target_blacklist)
var/list/temp = get_theft_list_objectives(type_theft_flag)
var/list/theft_types = temp.Copy()
while(!steal_target && length(theft_types))
var/thefttype = pick_n_take(theft_types)
if(choose_target(thefttype, target_blacklist))
return TRUE

explanation_text = "Free Objective."
return FALSE
Expand Down
10 changes: 7 additions & 3 deletions code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ GLOBAL_LIST_EMPTY(antagonists)
* Arguments:
* * objective_type - A type path of an objective, for example: /datum/objective/steal
* * explanation_text - the explanation text that will be passed into the objective's `New()` proc
* * mob/target_override - a target for the objective
* * target_override - a target for the objective
*/
/datum/antagonist/proc/add_objective(objective_type, explanation_text = "", mob/target_override = null)
/datum/antagonist/proc/add_objective(objective_type, explanation_text = "", target_override = null)
var/datum/objective/new_objective = objective_type
if(ispath(objective_type))
new_objective = new objective_type(explanation_text)
Expand All @@ -346,17 +346,21 @@ GLOBAL_LIST_EMPTY(antagonists)

var/found_valid_target = FALSE

if(target_override)
if(!istype(new_objective, /datum/objective/steal) && target_override)
new_objective.target = target_override
found_valid_target = TRUE

else
if(istype(new_objective, /datum/objective/steal))
var/datum/objective/steal/our_objective = new_objective
var/list/steal_target_ids = list()
if(target_override)
our_objective.choose_target(target_override)

for(var/datum/objective/steal/steal_objective in owner.get_all_objectives())
if(!steal_objective.steal_target?.id)
continue

steal_target_ids |= steal_objective.steal_target.id

if(our_objective.find_target(target_blacklist = steal_target_ids))
Expand Down
23 changes: 23 additions & 0 deletions code/modules/antagonists/traitor/affiliates/_affiliates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,26 @@

/datum/affiliate/proc/give_default_objective()
traitor.forge_single_objective()

/datum/affiliate/proc/gen_steal_objective(list/weights)
var/list/possible = list()
var/list/blacklist = list()
for(var/datum/objective/steal/steal_objective in traitor.owner.get_all_objectives())
if(!steal_objective.steal_target)
continue

blacklist.Add(steal_objective.steal_target.typepath)

for(var/O in GLOB.potential_theft_objectives)
if(O in blacklist)
continue

possible[O] = 1

for(var/O in weights)
if(O in blacklist)
continue

possible[O] = weights[O]

return pick_weight_n_take(possible)
57 changes: 43 additions & 14 deletions code/modules/antagonists/traitor/affiliates/cybersun.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#define CYBERSUN_DISCOUNT 0.8
GLOBAL_LIST_INIT(cybersun_theft_objectives_weights, list(
/datum/theft_objective/highrisk/antique_laser_gun = 1.3,
/datum/theft_objective/highrisk/captains_jetpack = 1.2,
/datum/theft_objective/highrisk/captains_rapier = 0.6,
/datum/theft_objective/highrisk/hoslaser = 1.3,
/datum/theft_objective/highrisk/hand_tele = 2,
/datum/theft_objective/highrisk/ai = 2,
/datum/theft_objective/highrisk/defib = 1.2,
/datum/theft_objective/highrisk/magboots = 1.1,
/datum/theft_objective/highrisk/combatrcd = 1.3,
/datum/theft_objective/highrisk/blueprints = 0.7,
/datum/theft_objective/highrisk/capmedal = 0.4,
/datum/theft_objective/highrisk/nukedisc = 0.5,
/datum/theft_objective/highrisk/reactive = 1.5,
/datum/theft_objective/highrisk/documents = 0.4,
/datum/theft_objective/highrisk/hypospray = 1.2,
/datum/theft_objective/highrisk/ablative = 1.1,
/datum/theft_objective/highrisk/krav = 1.1,
/datum/theft_objective/highrisk/supermatter_sliver = 0.6,
/datum/theft_objective/highrisk/plutonium_core = 0.6,
))

/datum/affiliate/cybersun
name = AFFIL_CYBERSUN
Expand All @@ -19,36 +39,45 @@
icon_state = "cybersun"
hij_obj = /datum/objective/make_ai_malf
normal_objectives = 4
objectives = list(list(/datum/objective/steal = 60, /datum/objective/steal/ai = 20, /datum/objective/new_mini_traitor = 20),
/datum/objective/download_data,
// /datum/objective/mecha_or_pod_hijack,
objectives = list(list(/datum/objective/download_data = 70, /datum/objective/steal/ai = 10, /datum/objective/new_mini_traitor = 20),
/datum/objective/escape,
)

/datum/affiliate/cybersun/finalize_affiliate()
. = ..()
for(var/path in subtypesof(/datum/uplink_item/implants))
add_discount_item(path, CYBERSUN_DISCOUNT)
add_discount_item(path, 0.8)

add_discount_item(/datum/uplink_item/device_tools/hacked_module, 2/3)

/datum/affiliate/cybersun/give_default_objective()
/datum/affiliate/cybersun/proc/gen_default_objective()
if(prob(40))
if(length(active_ais()) && prob(100 / length(GLOB.player_list)))
traitor.add_objective(/datum/objective/destroy)
return /datum/objective/destroy

else if(prob(5))
traitor.add_objective(/datum/objective/debrain)
return /datum/objective/debrain

else if(prob(15))
traitor.add_objective(/datum/objective/protect)
return /datum/objective/protect

else if(prob(5))
traitor.add_objective(/datum/objective/mecha_or_pod_hijack)
else if(prob(10))
return /datum/objective/mecha_or_pod_hijack

else
traitor.add_objective(/datum/objective/maroon)
return /datum/objective/maroon

else
traitor.add_objective(/datum/objective/steal)
return /datum/objective/steal

#undef CYBERSUN_DISCOUNT
/datum/affiliate/cybersun/give_default_objective()
var/obj_type = gen_default_objective()
if(obj_type != /datum/objective/steal)
traitor.add_objective(obj_type)
return

var/target_type = gen_steal_objective(GLOB.cybersun_theft_objectives_weights)
if(target_type)
traitor.add_objective(/datum/objective/steal, target_override = target_type)
else
traitor.add_objective(/datum/objective/steal)
34 changes: 26 additions & 8 deletions code/modules/antagonists/traitor/affiliates/hematogenic.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
GLOBAL_LIST_INIT(hematogenic_theft_objectives_weights, list(
/datum/theft_objective/highrisk/defib = 3,
/datum/theft_objective/highrisk/hypospray = 3,
))

/datum/affiliate/hematogenic
name = AFFIL_HEMATOGENIC
affil_info = list("Фармацевтическая мега корпорация подозревающаяся в связях с вампирами.",
Expand All @@ -15,25 +20,38 @@
icon_state = "hematogenic"
hij_obj = /datum/objective/blood/ascend
normal_objectives = 2
objectives = list(/datum/objective/harvest_blood,
/datum/objective/steal/hypo_or_defib,
list(/datum/objective/steal = 50, /datum/objective/steal/hypo_or_defib = 30, /datum/objective/new_mini_vampire = 20),
objectives = list(list(/datum/objective/harvest_blood = 80, /datum/objective/new_mini_vampire = 20),
/datum/objective/escape
)

/datum/affiliate/hematogenic/get_weight(mob/living/carbon/human/H)
return (!ismachineperson(H) && H.mind?.assigned_role != JOB_TITLE_CHAPLAIN) * 2

/datum/affiliate/hematogenic/give_default_objective()
/datum/affiliate/hematogenic/proc/gen_default_objective()
if(prob(60))
if(prob(5))
traitor.add_objective(/datum/objective/debrain)
if(length(active_ais()) && prob(100 / length(GLOB.player_list)))
return /datum/objective/destroy

else if(prob(5))
return /datum/objective/debrain

else if(prob(10))
traitor.add_objective(/datum/objective/protect)
return /datum/objective/protect

else
traitor.add_objective(/datum/objective/maroon)
return /datum/objective/maroon

else
return /datum/objective/steal

/datum/affiliate/hematogenic/give_default_objective()
var/obj_type = gen_default_objective()
if(obj_type != /datum/objective/steal)
traitor.add_objective(obj_type)
return

var/target_type = gen_steal_objective(GLOB.hematogenic_theft_objectives_weights)
if(target_type)
traitor.add_objective(/datum/objective/steal, target_override = target_type)
else
traitor.add_objective(/datum/objective/steal)
35 changes: 26 additions & 9 deletions code/modules/antagonists/traitor/affiliates/mi13.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
GLOBAL_LIST_INIT(mi13_theft_objectives_weights, list(
/datum/theft_objective/highrisk/blueprints = 2,
/datum/theft_objective/highrisk/documents = 2,
))

/datum/affiliate/mi13
name = AFFIL_MI13
affil_info = list("Агенство специализирующееся на добыче и продаже секретной информации и разработок.",
Expand Down Expand Up @@ -27,6 +32,9 @@
var/datum/antagonist/traitor/traitor = owner.has_antag_datum(/datum/antagonist/traitor)
traitor.assign_exchange_role(SSticker.mode.exchange_red)
uplink.get_intelligence_data = TRUE
for(var/path in subtypesof(/datum/uplink_item/stealthy_tools))
add_discount_item(path, 0.8)

add_discount_item(/datum/uplink_item/stealthy_weapons/cqc, 0.8)

/datum/affiliate/mi13/give_bonus_objectives(datum/mind/mind)
Expand All @@ -35,22 +43,31 @@
traitor.add_objective(/datum/objective/steal)
traitor.add_objective(/datum/objective/steal)

/datum/affiliate/mi13/give_default_objective()
/datum/affiliate/mi13/proc/gen_default_objective()
if(prob(40))
if(length(active_ais()) && prob(100 / length(GLOB.player_list)))
traitor.add_objective(/datum/objective/destroy)
return /datum/objective/destroy

else if(prob(5))
traitor.add_objective(/datum/objective/debrain)
return /datum/objective/debrain

else if(prob(10))
traitor.add_objective(/datum/objective/protect)

else if(prob(5))
traitor.add_objective(/datum/objective/steal/documents)
else if(prob(15))
return /datum/objective/protect

else
traitor.add_objective(/datum/objective/maroon)
return pickweight(list(/datum/objective/maroon = 40, /datum/objective/maroon/agent = 60))

else
return /datum/objective/steal

/datum/affiliate/mi13/give_default_objective()
var/obj_type = gen_default_objective()
if(obj_type != /datum/objective/steal)
traitor.add_objective(obj_type)
return

var/target_type = gen_steal_objective(GLOB.mi13_theft_objectives_weights)
if(target_type)
traitor.add_objective(/datum/objective/steal, target_override = target_type)
else
traitor.add_objective(/datum/objective/steal)

0 comments on commit a2b97c1

Please sign in to comment.