diff --git a/docs/plugins/sort.rst b/docs/plugins/sort.rst index e8e280f61..8ec9fefcc 100644 --- a/docs/plugins/sort.rst +++ b/docs/plugins/sort.rst @@ -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 skill they have in leader, teacher, or military tactics. -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 -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 -humanoid creatures) that are expected to be more effective in melee combat -against opponents of similar skill levels. - -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 -account genetic predispositions in physical and mental attributes. -The goal is to assign a higher value to dwarves (and other humanoid creatures) -that are expected to be more effective in ranged combat. - -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 -facets and values of an individual and correlates to better stress values. +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 +account genetic predispositions in physical and mental attributes, as +well as body size. Dwarves (and other humanoid creatures) with bigger rating +are expected to be more effective in melee combat against opponents of +similar skill levels. + +If sorting is done by "ranged potential" citizens are arranged based on their +ranged potential rating. This rating is a statistical measure that takes into +account genetic predispositions in physical and mental attributes. +Dwarves (and other humanoid creatures) with bigger rating are expected to be +more effective in ranged combat. + +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 +facets and values of an individual and correlates to better stress values. 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 diff --git a/plugins/lua/sort.lua b/plugins/lua/sort.lua index ae6ea4eeb..ee2f38c34 100644 --- a/plugins/lua/sort.lua +++ b/plugins/lua/sort.lua @@ -205,7 +205,7 @@ local function make_sort_by_skill_asc(sort_skill) 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! local function melee_potential(unit) -- Physical attributes @@ -213,20 +213,16 @@ local function melee_potential(unit) local agility = unit.body.physical_attrs.AGILITY.max_value local toughness = unit.body.physical_attrs.TOUGHNESS.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 - local focus = unit.status.current_soul.mental_attrs.FOCUS.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 kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value - -- strength/bodysize is a dirty approximation of momentum formula - local rating = 10000*strength/bodySize + strength*4 + agility*3 + toughness - + endurance + recuperation/3 + diseaseResistance/3 - + kinestheticSense*3 + willpower/2 + spatialSense/2 + focus/4 + -- Melee potential rating + local rating = strength*5.8 + kinestheticSense*3.7 + bodySize*2 + agility*2 + endurance*1.8 + + willpower*1.5 * spatialSense*1.5 + toughness*1.5 return rating end @@ -258,17 +254,13 @@ local function sort_by_melee_potential_asc(unit_id_1, unit_id_2) return utils.compare(rating1, rating2) 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! local function ranged_potential(unit) -- Physical attributes - local strength = unit.body.physical_attrs.STRENGTH.max_value local agility = unit.body.physical_attrs.AGILITY.max_value local toughness = unit.body.physical_attrs.TOUGHNESS.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 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 kinestheticSense = unit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.max_value - local rating = strength + agility*4 + toughness + endurance + recuperation/2 - + diseaseResistance/2 - bodySize/2 - + kinestheticSense + willpower + spatialSense*3 + focus + -- Ranged potential formula + local rating = agility*3.9 + kinestheticSense*3 + spatialSense*2.9 + toughness*0.9 + + focus*0.7 + endurance*0.7 + willpower*0.6 return rating end