Apply suggestions from code review

develop
Myk 2023-08-30 23:26:03 -07:00 committed by GitHub
parent 2c97ab9c8d
commit 4a788e79c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 7 deletions

@ -81,6 +81,9 @@ local function sort_by_stress_desc(unit_id_1, unit_id_2)
if not unit2 then return 1 end
local happiness1 = unit1.status.current_soul.personality.stress
local happiness2 = unit2.status.current_soul.personality.stress
if happiness1 == happiness2 then
return sort_by_name_desc(unit_id_1, unit_id_2)
end
return utils.compare(happiness2, happiness1)
end
@ -92,6 +95,9 @@ local function sort_by_stress_asc(unit_id_1, unit_id_2)
if not unit2 then return 1 end
local happiness1 = unit1.status.current_soul.personality.stress
local happiness2 = unit2.status.current_soul.personality.stress
if happiness1 == happiness2 then
return sort_by_name_desc(unit_id_1, unit_id_2)
end
return utils.compare(happiness1, happiness2)
end
@ -138,9 +144,9 @@ local function melee_skill_effectiveness(unit, skill_list)
-- Skills
-- Finding the highest skill
skill_rating = 0
local skill_rating = 0
for _, skill in ipairs(skill_list) do
melee_skill = dfhack.units.getNominalSkill(unit, skill, true)
local melee_skill = dfhack.units.getNominalSkill(unit, skill, true)
skill_rating = math.max(skill_rating, melee_skill)
end
local melee_combat_rating = dfhack.units.getNominalSkill(unit, df.job_skill.MELEE_COMBAT, true)
@ -191,9 +197,9 @@ local function ranged_skill_effectiveness(unit, skill_list)
-- Skills
-- Finding the highest skill
skill_rating = 0
local skill_rating = 0
for _, skill in ipairs(skill_list) do
ranged_skill = dfhack.units.getNominalSkill(unit, skill, true)
local ranged_skill = dfhack.units.getNominalSkill(unit, skill, true)
skill_rating = math.max(skill_rating, ranged_skill)
end
local ranged_combat = dfhack.units.getNominalSkill(unit, df.job_skill.RANGED_COMBAT, true)