Skip to content

Commit

Permalink
Merge pull request #1067 from myk002/myk_armoks_blessing
Browse files Browse the repository at this point in the history
[armoks-blessing] don't bork on missing names for unused skills
  • Loading branch information
myk002 authored Apr 3, 2024
2 parents 7b05878 + e87357e commit 8012e84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
20 changes: 12 additions & 8 deletions armoks-blessing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,30 +204,34 @@ function BreathOfArmok(unit)
print ("The breath of Armok has engulfed "..unit.name.first_name)
end
-- ---------------------------------------------------------------------------
function LegendaryByClass(skilltype,v)
local unit=v
if unit==nil then
local function get_skill_desc(skill_idx)
return df.job_skill.attrs[skill_idx].caption or df.job_skill[skill_idx] or ("(unnamed skill %d)"):format(skill_idx)
end

function LegendaryByClass(skilltype, unit)
if not unit then
print ("No unit available! Aborting with extreme prejudice.")
return
end

local i
local skillclass
local count_max = count_this(df.job_skill)
for i=0, count_max do
skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if df.job_skill[i]:startswith('UNUSED') then goto continue end
local skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if skilltype == skillclass then
print ("Skill "..df.job_skill.attrs[i].caption.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
local skillname = get_skill_desc(i)
print ("Skill "..skillname.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
::continue::
end
end
-- ---------------------------------------------------------------------------
function PrintSkillList()
local count_max = count_this(df.job_skill)
local i
for i=0, count_max do
print("'"..df.job_skill.attrs[i].caption.."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])
print("'"..get_skill_desc(i).."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])
end
print ("Provide the UPPER CASE argument, for example: PROCESSPLANTS rather than Threshing")
end
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Template for new versions:
## Fixes
- `fix/loyaltycascade`: fix lookup of associated unit metadata when the metadata list is sparse (that is, the script was sometimes failing to fix the loyalties of renegate units because it was failing to find that unit's metadata)
- `quickfort`: reject tiles for building that contain magma or deep water
- `armoks-blessing`: fix error when making Normal class attributes legendary

## Misc Improvements
- `gui/reveal`: show aquifers even when not in mining mode
Expand Down

0 comments on commit 8012e84

Please sign in to comment.