Merge pull request #12677 from Ghommie/Ghommie-cit830
Fixes items' skills list keys missing associated traits and improves modulability a little.
This commit is contained in:
@@ -33,6 +33,10 @@ GLOBAL_LIST_INIT_TYPED(skill_datums, /datum/skill, init_skill_datums())
|
||||
var/base_multiplier = 1
|
||||
/// Value added to the base multiplier depending on overall competency compared to maximum value/level.
|
||||
var/competency_multiplier = 1
|
||||
/// Experience gain multiplier gained from using items.
|
||||
var/item_skill_gain_multi = 1
|
||||
/// Skill gain quantisation
|
||||
var/skill_gain_quantisation = 0.1
|
||||
/// A list of ways this skill can affect or be affected through actions and skill modifiers.
|
||||
var/list/skill_traits = list(SKILL_SANITY, SKILL_INTELLIGENCE)
|
||||
/// Index of this skill in the UI
|
||||
@@ -108,6 +112,10 @@ GLOBAL_LIST_INIT_TYPED(skill_datums, /datum/skill, init_skill_datums())
|
||||
/// Min value of this skill
|
||||
var/min_value = 0
|
||||
|
||||
/datum/skill/numerical/New()
|
||||
..()
|
||||
skill_gain_quantisation = item_skill_gain_multi = item_skill_gain_multi * (max_value - min_value) * STD_NUM_SKILL_ITEM_GAIN_MULTI
|
||||
|
||||
/datum/skill/numerical/sanitize_value(new_value)
|
||||
return clamp(new_value, min_value, max_value)
|
||||
|
||||
|
||||
@@ -91,10 +91,10 @@
|
||||
CRASH("Invalid set_skill_value call. Use skill typepaths.") //until a time when we somehow need text ids for dynamic skills, I'm enforcing this.
|
||||
var/datum/skill/S = GLOB.skill_datums[skill]
|
||||
value = S.sanitize_value(value)
|
||||
skill_holder.need_static_data_update = TRUE
|
||||
if(!isnull(value))
|
||||
LAZYINITLIST(skill_holder.skills)
|
||||
S.set_skill_value(skill_holder, value, src, silent)
|
||||
skill_holder.need_static_data_update = TRUE
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -120,11 +120,9 @@
|
||||
CRASH("You cannot auto increment a non numerical(experience skill!")
|
||||
var/current = get_skill_value(skill, FALSE)
|
||||
var/affinity = get_skill_affinity(skill)
|
||||
var/target_value = current + (value * affinity)
|
||||
if(maximum)
|
||||
target_value = min(target_value, maximum)
|
||||
if(target_value == maximum) //no more experience to gain, early return.
|
||||
return
|
||||
var/target_value = round(current + (value * affinity), S.skill_gain_quantisation)
|
||||
if(maximum && target_value >= maximum) //no more experience to gain, early return.
|
||||
return
|
||||
boost_skill_value_to(skill, target_value, silent, current)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user