[MIRROR] Increased odds of station traits a little. Introduced a "budget", so smaller traits only take half as much space. [MDB IGNORE] (#25980)

* Increased odds of station traits a little. Introduced a "budget", so smaller traits only take half as much space. (#80211)

## About The Pull Request
Recently, I chatted with others about how few station traits are rolled
on a round by round basis - about 59% of the shifts go without either
positive or negative traits for example - and how the mild most of these
traits are (not a bad thing per se), which results in an underwhelming
feature, despite the more interesting bits of it. So, after sharing
opinions, I've decided to make this PR to increase the rolls and odds a
bit.

EDIT: After reading comments and taking some time to think this
thoroughfully, I've decided to push the probabilities back a little in
favor of a simple budget system for station traits, to allow for smaller
things to only count as half a station trait. This mean smaller traits
won't necessarily stop "better" ones from rolling, or at least allow for
plentier permutations of traits that do not affect the round TOO much.
I've also reduced the weight of the glitched pda beeps trait from 15 to
10, the same of scarves, wallets and colored assistant jumpsuits.

## Why It's Good For The Game

I believe the current odds of station traits to be a smidge low, and
that the lack of any sort of cost-budget for station traits to hurt the
rarer, more interesting traits (and the feature in general) if the more
common, milder ones take just as much space. It's totally within the
spirit of the feature to have small, niche traits, though they can get
quite boring pretty fast on their own, so what I'm saying is that their
cost should stay low so that other traits can roll.

## Changelog

🆑
refactor: Introduced a simple budget system to station traits, so that
smaller things only count as half a trait, for example.
balance: Increased the odds and maximum number of station traits that
can be rolled each shift.
/🆑

* Increased odds of station traits a little. Introduced a "budget", so smaller traits only take half as much space.

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-01-04 18:00:10 +01:00
committed by GitHub
parent 9092c186ac
commit 698ecf2a7c
8 changed files with 86 additions and 17 deletions
@@ -73,22 +73,36 @@ PROCESSING_SUBSYSTEM_DEF(station)
selectable_traits_by_types[initial(trait_typepath.trait_type)][trait_typepath] = initial(trait_typepath.weight)
var/positive_trait_count = pick(20;0, 5;1, 1;2)
var/neutral_trait_count = pick(10;0, 10;1, 3;2)
var/negative_trait_count = pick(20;0, 5;1, 1;2)
var/positive_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/positive_station_traits)))
var/neutral_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/neutral_station_traits)))
var/negative_trait_budget = text2num(pick_weight(CONFIG_GET(keyed_list/negative_station_traits)))
pick_traits(STATION_TRAIT_POSITIVE, positive_trait_count)
pick_traits(STATION_TRAIT_NEUTRAL, neutral_trait_count)
pick_traits(STATION_TRAIT_NEGATIVE, negative_trait_count)
pick_traits(STATION_TRAIT_POSITIVE, positive_trait_budget)
pick_traits(STATION_TRAIT_NEUTRAL, neutral_trait_budget)
pick_traits(STATION_TRAIT_NEGATIVE, negative_trait_budget)
///Picks traits of a specific category (e.g. bad or good) and a specified amount, then initializes them, adds them to the list of traits,
///then removes them from possible traits as to not roll twice.
/datum/controller/subsystem/processing/station/proc/pick_traits(trait_sign, amount)
if(!amount)
/**
* Picks traits of a specific category (e.g. bad or good), initializes them, adds them to the list of traits,
* then removes them from possible traits as to not roll twice and subtracts their cost from the budget.
* All until the whole budget is spent or no more traits can be picked with it.
*/
/datum/controller/subsystem/processing/station/proc/pick_traits(trait_sign, budget)
if(!budget)
return
for(var/iterator in 1 to amount)
var/datum/station_trait/trait_type = pick_weight(selectable_traits_by_types[trait_sign]) //Rolls from the table for the specific trait type
selectable_traits_by_types[trait_sign] -= trait_type
///A list of traits of the same trait sign
var/list/selectable_traits = selectable_traits_by_types[trait_sign]
while(budget)
///Remove any station trait with a cost bigger than the budget
for(var/datum/station_trait/proto_trait as anything in selectable_traits)
if(initial(proto_trait.cost) > budget)
selectable_traits -= proto_trait
///We have spare budget but no trait that can be bought with what's left of it
if(!length(selectable_traits))
return
//Rolls from the table for the specific trait type
var/datum/station_trait/trait_type = pick_weight(selectable_traits)
selectable_traits -= trait_type
budget -= initial(trait_type.cost)
setup_trait(trait_type)
///Creates a given trait of a specific type, while also removing any blacklisted ones from the future pool.