|
|
@ -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
|
|
|
|
|
|
|
|
|
|
|
|