Changed melee and ranged ratings to statistically proven linear formulas.

develop
Mikhail 2023-08-25 16:18:20 +03:00
parent 30488dc310
commit 25f2c1746a
2 changed files with 24 additions and 32 deletions

@ -26,22 +26,22 @@ skill they have in crossbows or general ranged combat.
If sorted by "leadership", then the citizen is sorted according to the highest If sorted by "leadership", then the citizen is sorted according to the highest
skill they have in leader, teacher, or military tactics. skill they have in leader, teacher, or military tactics.
If sorting is done by "melee potential" citizens are arranged based on their If sorting is done by "melee potential" citizens are arranged based on their
melee potential rating. This rating is a heuristic measure that takes into melee potential rating. This rating is a heuristic measure that takes into
account genetic predispositions in physical and mental attributes, as account genetic predispositions in physical and mental attributes, as
well as body size. The goal is to assign a higher value to dwarves (and other well as body size. Dwarves (and other humanoid creatures) with bigger rating
humanoid creatures) that are expected to be more effective in melee combat are expected to be more effective in melee combat against opponents of
against opponents of similar skill levels. similar skill levels.
If sorting is done by "ranged potential" citizens are arranged based on their If sorting is done by "ranged potential" citizens are arranged based on their
ranged potential rating. This rating is a heuristic measure that takes into ranged potential rating. This rating is a statistical measure that takes into
account genetic predispositions in physical and mental attributes. account genetic predispositions in physical and mental attributes.
The goal is to assign a higher value to dwarves (and other humanoid creatures) Dwarves (and other humanoid creatures) with bigger rating are expected to be
that are expected to be more effective in ranged combat. more effective in ranged combat.
If sorting is done by "mental stability" citizens are arranged based on their If sorting is done by "mental stability" citizens are arranged based on their
mental stability rating. This rating is a measure that takes into account mental stability rating. This rating is a measure that takes into account
facets and values of an individual and correlates to better stress values. facets and values of an individual and correlates to better stress values.
It is designed to be higher for more stress-resistant citizens. It is designed to be higher for more stress-resistant citizens.
You can search for a dwarf by name by typing in the Search field. You can also You can search for a dwarf by name by typing in the Search field. You can also

@ -205,7 +205,7 @@ local function make_sort_by_skill_asc(sort_skill)
end end
end end
-- Heuristic rating that is bigger for more potent dwarves in long run melee military training -- Statistical rating that is bigger for more potent dwarves in long run melee military training
-- Wounds are not considered! -- Wounds are not considered!
local function melee_potential(unit) local function melee_potential(unit)
-- Physical attributes -- Physical attributes
@ -213,20 +213,16 @@ local function melee_potential(unit)
local agility = unit.body.physical_attrs.AGILITY.max_value local agility = unit.body.physical_attrs.AGILITY.max_value
local toughness = unit.body.physical_attrs.TOUGHNESS.max_value local toughness = unit.body.physical_attrs.TOUGHNESS.max_value
local endurance = unit.body.physical_attrs.ENDURANCE.max_value local endurance = unit.body.physical_attrs.ENDURANCE.max_value
local recuperation = dfhack.units.getPhysicalAttrValue(unit, df.physical_attribute_type.RECUPERATION)
local diseaseResistance = dfhack.units.getPhysicalAttrValue(unit, df.physical_attribute_type.DISEASE_RESISTANCE)
local bodySize = unit.body.size_info.size_base local bodySize = unit.body.size_info.size_base
-- Mental attributes -- Mental attributes
local focus = unit.status.current_soul.mental_attrs.FOCUS.max_value
local willpower = unit.status.current_soul.mental_attrs.WILLPOWER.max_value local willpower = unit.status.current_soul.mental_attrs.WILLPOWER.max_value
local spatialSense = unit.status.current_soul.mental_attrs.SPATIAL_SENSE.max_value local spatialSense = unit.status.current_soul.mental_attrs.SPATIAL_SENSE.max_value
local kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value local kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value
-- strength/bodysize is a dirty approximation of momentum formula -- Melee potential rating
local rating = 10000*strength/bodySize + strength*4 + agility*3 + toughness local rating = strength*5.8 + kinestheticSense*3.7 + bodySize*2 + agility*2 + endurance*1.8
+ endurance + recuperation/3 + diseaseResistance/3 + willpower*1.5 * spatialSense*1.5 + toughness*1.5
+ kinestheticSense*3 + willpower/2 + spatialSense/2 + focus/4
return rating return rating
end end
@ -258,17 +254,13 @@ local function sort_by_melee_potential_asc(unit_id_1, unit_id_2)
return utils.compare(rating1, rating2) return utils.compare(rating1, rating2)
end end
-- Heuristic rating that is bigger for more potent dwarves in long run ranged military training -- Statistical rating that is bigger for more potent dwarves in long run ranged military training
-- Wounds are not considered! -- Wounds are not considered!
local function ranged_potential(unit) local function ranged_potential(unit)
-- Physical attributes -- Physical attributes
local strength = unit.body.physical_attrs.STRENGTH.max_value
local agility = unit.body.physical_attrs.AGILITY.max_value local agility = unit.body.physical_attrs.AGILITY.max_value
local toughness = unit.body.physical_attrs.TOUGHNESS.max_value local toughness = unit.body.physical_attrs.TOUGHNESS.max_value
local endurance = unit.body.physical_attrs.ENDURANCE.max_value local endurance = unit.body.physical_attrs.ENDURANCE.max_value
local recuperation = dfhack.units.getPhysicalAttrValue(unit, df.physical_attribute_type.RECUPERATION)
local diseaseResistance = dfhack.units.getPhysicalAttrValue(unit, df.physical_attribute_type.DISEASE_RESISTANCE)
local bodySize = unit.body.size_info.size_base
-- Mental attributes -- Mental attributes
local focus = unit.status.current_soul.mental_attrs.FOCUS.max_value local focus = unit.status.current_soul.mental_attrs.FOCUS.max_value
@ -276,9 +268,9 @@ local function ranged_potential(unit)
local spatialSense = unit.status.current_soul.mental_attrs.SPATIAL_SENSE.max_value local spatialSense = unit.status.current_soul.mental_attrs.SPATIAL_SENSE.max_value
local kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value local kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value
local rating = strength + agility*4 + toughness + endurance + recuperation/2 -- Ranged potential formula
+ diseaseResistance/2 - bodySize/2 local rating = agility*3.9 + kinestheticSense*3 + spatialSense*2.9 + toughness*0.9
+ kinestheticSense + willpower + spatialSense*3 + focus + focus*0.7 + endurance*0.7 + willpower*0.6
return rating return rating
end end