Skip to content

Commit

Permalink
Some experimental changes (#1400)
Browse files Browse the repository at this point in the history
* Attributes rescaled

* Overload success rates made worse

* Pointless neat code for maximum attribute levels per threat level

* Small fixes to the attribute bonus display

* Tweaks to fortitude & prudence numbers.

* Attributes re-scaled again

Fortitude and Prudence provide 1.1 HP/SP. People start with 90 max.

* Personal overload chances

* Temporarily restores old fort & prud scaling
  • Loading branch information
EgorDinamit authored Oct 16, 2023
1 parent 51ee678 commit f608b33
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 45 deletions.
12 changes: 11 additions & 1 deletion code/__DEFINES/abnormalities.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@
WAW_LEVEL = COLOR_PURPLE,\
ALEPH_LEVEL = COLOR_RED,\
)

#define THREAT_TO_CSS_COLOR list(\
ZAYIN_LEVEL = "green",\
TETH_LEVEL = "blue",\
HE_LEVEL = "orange",\
WAW_LEVEL = "purple",\
ALEPH_LEVEL = "red",\
)
)

// The maximum attribute level you can get from each abnormality threat level
#define THREAT_TO_ATTRIBUTE_LIMIT list(\
ZAYIN_LEVEL = 40,\
TETH_LEVEL = 60,\
HE_LEVEL = 80,\
WAW_LEVEL = 100,\
ALEPH_LEVEL = 200,\
)

// Origins
#define ABNORMALITY_ORIGIN_ORIGINAL "Original"
Expand Down
13 changes: 13 additions & 0 deletions code/__DEFINES/attributes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,16 @@
ABNORMALITY_WORK_ATTACHMENT = TEMPERANCE_ATTRIBUTE,\
ABNORMALITY_WORK_REPRESSION = JUSTICE_ATTRIBUTE,\
)


/// The max human health is adjusted to default define + fortitude points * this modifier
#define FORTITUDE_MOD 1

/// Same as above, but for sanity and prudence
#define PRUDENCE_MOD 1

/// How much temperance affects the success rate of the works; Higher = better.
#define TEMPERANCE_SUCCESS_MOD 0.2

/// The justice attribute is divided by this number to decide the movement speed buff; The higher it is - the lower is maximum speed
#define JUSTICE_MOVESPEED_DIVISER 230
4 changes: 4 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@

// Health/damage defines
#define MAX_LIVING_HEALTH 100
/// Maximum health of a human mob, without fortitude
#define DEFAULT_HUMAN_MAX_HEALTH 100
/// Maximum sanity of a human mob, without prudence
#define DEFAULT_HUMAN_MAX_SANITY 100

#define HUMAN_MAX_OXYLOSS 3
#define HUMAN_CRIT_MAX_OXYLOSS (SSmobs.wait/30)
Expand Down
43 changes: 17 additions & 26 deletions code/datums/abnormality/datum/abnormality.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@
var/list/current_ego = list()
/// How many PE boxes we have available for use on EGO purchase
var/stored_boxes = 0
/// Current overload chance reduction applied to general work chance. Displayed on abnormality console and is reset on meltdown
var/overload_chance = 0
/// Associative list of ckey = overload chance; It is reset each meltdown.
var/list/overload_chance = list()
/// Amount of reduction applied on each work session
var/overload_chance_amount = 0
/// Limit on overload_chance; By default equal to amount * 10
var/overload_chance_limit = 100
/// Simulated Observation Bonuses
var/understanding = 0
var/max_understanding = 0
/// The limit for maximum attribute level you can achieve working on this abnormality
var/maximum_attribute_level = 0
/// A list of performed works on it
var/list/work_logs = list()
/*
Expand Down Expand Up @@ -96,6 +98,7 @@
threat_level = current.threat_level
qliphoth_meter_max = current.start_qliphoth
qliphoth_meter = qliphoth_meter_max
maximum_attribute_level = THREAT_TO_ATTRIBUTE_LIMIT[threat_level]
if(!current.max_boxes)
max_boxes = threat_level * 6
else
Expand All @@ -117,12 +120,12 @@
if(HE_LEVEL)
max_understanding = 8
if(WAW_LEVEL)
overload_chance_amount = -2
overload_chance_amount = -4
max_understanding = 6
if(ALEPH_LEVEL)
overload_chance_amount = -4
overload_chance_amount = -6
max_understanding = 6
if (understanding == max_understanding && max_understanding > 0)
if(understanding == max_understanding && max_understanding > 0)
current.gift_chance *= 1.5
overload_chance_limit = overload_chance_amount * 10
if(abno_radio)
Expand All @@ -145,18 +148,6 @@
return
if(pe > 0) // Work did not fail
var/attribute_type = current.work_attribute_types[work_type]
var/maximum_attribute_level = 0
switch(threat_level)
if(ZAYIN_LEVEL)
maximum_attribute_level = 40
if(TETH_LEVEL)
maximum_attribute_level = 60
if(HE_LEVEL)
maximum_attribute_level = 80
if(WAW_LEVEL)
maximum_attribute_level = 100
if(ALEPH_LEVEL)
maximum_attribute_level = 130
var/datum/attribute/user_attribute = user.attributes[attribute_type]
if(user_attribute) //To avoid runtime if it's a custom work type like "Release".
var/user_attribute_level = max(1, user_attribute.level)
Expand Down Expand Up @@ -187,8 +178,7 @@
current.gift_chance *= 1.5
SSlobotomy_corp.understood_abnos++
stored_boxes += round(pe * SSlobotomy_corp.box_work_multiplier)
if(overload_chance > overload_chance_limit)
overload_chance += overload_chance_amount
overload_chance[user.ckey] = max(overload_chance[user.ckey] + overload_chance_amount, overload_chance_limit)

/datum/abnormality/proc/qliphoth_change(amount, user)
var/pre_qlip = qliphoth_meter
Expand Down Expand Up @@ -222,17 +212,18 @@
acquired_chance = acquired_chance[work_level]
if(current)
acquired_chance = current.WorkChance(user, acquired_chance, workType)
switch (workType)
if (ABNORMALITY_WORK_INSTINCT)
switch(workType)
if(ABNORMALITY_WORK_INSTINCT)
acquired_chance += user.physiology.instinct_success_mod
if (ABNORMALITY_WORK_INSIGHT)
if(ABNORMALITY_WORK_INSIGHT)
acquired_chance += user.physiology.insight_success_mod
if (ABNORMALITY_WORK_ATTACHMENT)
if(ABNORMALITY_WORK_ATTACHMENT)
acquired_chance += user.physiology.attachment_success_mod
if (ABNORMALITY_WORK_REPRESSION)
if(ABNORMALITY_WORK_REPRESSION)
acquired_chance += user.physiology.repression_success_mod
acquired_chance *= user.physiology.work_success_mod
acquired_chance += get_modified_attribute_level(user, TEMPERANCE_ATTRIBUTE) / 5 // For a maximum of 26 at 130 temperance
acquired_chance += get_modified_attribute_level(user, TEMPERANCE_ATTRIBUTE) * TEMPERANCE_SUCCESS_MOD
acquired_chance += understanding // Adds up to 6-10% [Threat Based] work chance based off works done on it. This simulates Observation Rating which we lack ENTIRELY and as such has inflated the overall failure rate of abnormalities.
acquired_chance += overload_chance
if(overload_chance[user.ckey])
acquired_chance += overload_chance[user.ckey]
return clamp(acquired_chance, 0, 100)
8 changes: 7 additions & 1 deletion code/datums/attributes/_attribute.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GLOBAL_LIST_INIT(attribute_types, list(
var/level_bonus = 0
/// What it affects
var/list/affected_stats = list()
/// The initial value of the affected stat. 100 in the case of health/sanity
/// The initial value of the affected stat. DEFAULT_HUMAN_MAX_HEALTH and DEFAULT_HUMAN_MAX_SANITY for health/sanity
var/initial_stat_value = 0

// Procs
Expand All @@ -40,6 +40,12 @@ GLOBAL_LIST_INIT(attribute_types, list(
/datum/attribute/proc/get_level_bonus() // Returns current level of bonus
return level_bonus

// Used in show_attributes() human proc
// Returns current level + initial_stat_value adjusted with information such as modifiers
// Mainly used by fortitude & prudence
/datum/attribute/proc/get_printed_level_bonus()
return round(level) + initial_stat_value

/datum/attribute/proc/on_update(mob/living/carbon/user)
return

Expand Down
5 changes: 4 additions & 1 deletion code/datums/attributes/fortitude.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
name = FORTITUDE_ATTRIBUTE
desc = "Attribute responsible for maximum health level."
affected_stats = list("Max Health")
initial_stat_value = 100
initial_stat_value = DEFAULT_HUMAN_MAX_HEALTH

/datum/attribute/fortitude/get_printed_level_bonus()
return round(level * FORTITUDE_MOD) + initial_stat_value
2 changes: 1 addition & 1 deletion code/datums/attributes/justice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
/datum/attribute/justice/on_update(mob/living/carbon/user)
if(!istype(user))
return FALSE
var/slowdown = -(get_modified_level()/260) // Maximum being -0.5, without buffs
var/slowdown = -(get_modified_level() / JUSTICE_MOVESPEED_DIVISER)
user.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/justice_attribute, multiplicative_slowdown = slowdown)
return TRUE
5 changes: 4 additions & 1 deletion code/datums/attributes/prudence.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
name = PRUDENCE_ATTRIBUTE
desc = "Attribute responsible for maximum sanity points."
affected_stats = list("Max Sanity")
initial_stat_value = 100
initial_stat_value = DEFAULT_HUMAN_MAX_SANITY

/datum/attribute/prudence/get_printed_level_bonus()
return round(level * PRUDENCE_MOD) + initial_stat_value
10 changes: 6 additions & 4 deletions code/game/machinery/computer/abnormality_work.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
. += "<span class='info'>Risk Level:</span> [threat_level]<span class='info'>.</span>" // Professionals have standards
if(datum_reference.qliphoth_meter_max > 0)
. += "<span class='info'>Current Qliphoth Counter: [datum_reference.qliphoth_meter].</span>"
if(datum_reference.overload_chance != 0)
. += "<span class='warning'>Current Qliphoth Overload: [datum_reference.overload_chance]%.</span>"
if(datum_reference.overload_chance[user.ckey])
. += "<span class='warning'>Current Personal Qliphoth Overload: [datum_reference.overload_chance[user.ckey]]%.</span>"
if(meltdown)
var/melt_text = ""
switch(meltdown)
Expand All @@ -69,8 +69,10 @@
return
var/dat
dat += "<b><span style='color: [THREAT_TO_COLOR[datum_reference.threat_level]]'>\[[THREAT_TO_NAME[datum_reference.threat_level]]\]</span> [datum_reference.name]</b><br>"
if(datum_reference.overload_chance != 0)
dat += "<span style='color: [COLOR_VERY_SOFT_YELLOW]'>Work Success Rates are modified by [datum_reference.overload_chance]%.</span><br>"
if(datum_reference.overload_chance[user.ckey])
dat += "<span style='color: [COLOR_VERY_SOFT_YELLOW]'>Personal Work Success Rates are modified by [datum_reference.overload_chance[user.ckey]]%.</span><br>"
if(datum_reference.overload_chance_limit < 0 && datum_reference.overload_chance[user.ckey] <= datum_reference.overload_chance_limit) // How the fuck did you hit the limit..?
dat += "<span style='color: [COLOR_MOSTLY_PURE_RED]'>Work on other abnormalities, I beg you...</span><br>"
if(datum_reference.understanding != 0)
dat += "<span style='color: [COLOR_BLUE_LIGHT]'>Current Understanding is: [round((datum_reference.understanding/datum_reference.max_understanding)*100, 0.01)]%, granting a [datum_reference.understanding]% Work Success and Speed bonus.</span><br>"
dat += "<br>"
Expand Down
15 changes: 8 additions & 7 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
for(var/atrname in attributes) //raw stats (health, sanity etc)
var/datum/attribute/atr = attributes[atrname]
for(var/stat in atr.affected_stats)
dat += "[stat] : [round(atr.get_level()) + atr.initial_stat_value] + [round(atr.level_bonus)]" //todo: calculate work chance/speed/etc for respective values
dat += "[stat] : [atr.get_printed_level_bonus()] + [round(atr.level_bonus)]" //todo: calculate work chance/speed/etc for respective values

var/datum/browser/popup = new(viewer, "skills", "<div align='center'>Attributes</div>", 300, 350)
popup.set_content(dat.Join("<br>"))
Expand Down Expand Up @@ -1238,8 +1238,8 @@

/mob/living/carbon/human/updatehealth()
if(LAZYLEN(attributes))
maxHealth = 100 + round(get_modified_attribute_level(src, FORTITUDE_ATTRIBUTE))
maxSanity = 100 + round(get_modified_attribute_level(src, PRUDENCE_ATTRIBUTE))
maxHealth = DEFAULT_HUMAN_MAX_HEALTH + round(get_attribute_level(src, FORTITUDE_ATTRIBUTE) * FORTITUDE_MOD + get_level_bonus(src, FORTITUDE_ATTRIBUTE))
maxSanity = DEFAULT_HUMAN_MAX_SANITY + round(get_attribute_level(src, PRUDENCE_ATTRIBUTE) * PRUDENCE_MOD + get_level_bonus(src, PRUDENCE_ATTRIBUTE))
. = ..()
dna?.species.spec_updatehealth(src)
sanityhealth = maxSanity - sanityloss
Expand All @@ -1249,10 +1249,11 @@
remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown)
remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying)
return
var/health_deficiency = max((maxHealth - health), staminaloss)
if(health_deficiency >= 40)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown, TRUE, multiplicative_slowdown = health_deficiency / 200)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying, TRUE, multiplicative_slowdown = health_deficiency / 100)
// Gets a percent of lost health and applies the slowdown
var/health_missing_percent = (maxHealth - health) / maxHealth
if(health_missing_percent > 0.5)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown, TRUE, multiplicative_slowdown = health_missing_percent * 0.5)
add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying, TRUE, multiplicative_slowdown = health_missing_percent * 0.25)
else
remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown)
remove_movespeed_modifier(/datum/movespeed_modifier/damage_slowdown_flying)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/physiology.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

var/hunger_mod = 1 //% of hunger rate taken per tick.

var/work_success_mod = 1 // % Modifier to the success rate of works
var/work_success_mod = 1 // Multiplicative modifier to the success rate of works
var/instinct_success_mod = 0 // Additive Modifier to the success rate of Instinct works
var/insight_success_mod = 0 // Additive Modifier to the success rate of Insight works
var/attachment_success_mod = 0 // Additive Modifier to the success rate of Attachment works
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@
// On lobotomy_corp subsystem qliphoth event
/mob/living/simple_animal/hostile/abnormality/proc/OnQliphothEvent()
if(istype(datum_reference)) // Reset chance debuff
datum_reference.overload_chance = 0
datum_reference.overload_chance = list()
return

// When qliphoth meltdown begins
/mob/living/simple_animal/hostile/abnormality/proc/MeltdownStart()
if(istype(datum_reference))
datum_reference.overload_chance = 0
datum_reference.overload_chance = list()
return

/mob/living/simple_animal/hostile/abnormality/proc/OnQliphothChange(mob/living/carbon/human/user, amount = 0, pre_qlip = start_qliphoth)
Expand Down

0 comments on commit f608b33

Please sign in to comment.