@@ -13,6 +13,7 @@ Without arguments, all attributes, age & personalities are adjusted.
1313Arguments allow for skills to be adjusted as well.
1414
1515]====]
16+ local utils = require ' utils'
1617function rejuvenate (unit )
1718 if unit == nil then
1819 print (" No unit available! Aborting with extreme prejudice." )
@@ -51,18 +52,14 @@ function elevate_attributes(unit)
5152 return
5253 end
5354
54- local ok ,f ,t ,k = pcall (pairs ,unit .status .current_soul .mental_attrs )
55- if ok then
56- for k ,v in f ,t ,k do
55+ if unit .status .current_soul then
56+ for k ,v in pairs (unit .status .current_soul .mental_attrs ) do
5757 v .value = v .max_value
5858 end
5959 end
6060
61- local ok ,f ,t ,k = pcall (pairs ,unit .body .physical_attrs )
62- if ok then
63- for k ,v in f ,t ,k do
64- v .value = v .max_value
65- end
61+ for k ,v in pairs (unit .body .physical_attrs ) do
62+ v .value = v .max_value
6663 end
6764end
6865-- ---------------------------------------------------------------------------
@@ -95,7 +92,6 @@ function make_legendary(skillname,unit)
9592 end
9693
9794 if skillnamenoun ~= nil then
98- utils = require ' utils'
9995 skillnum = df .job_skill [skillname ]
10096 utils .insert_or_update (unit .status .current_soul .skills , { new = true , id = skillnum , rating = 20 }, ' id' )
10197 print (unit .name .first_name .. " is now a Legendary " .. skillnamenoun )
@@ -114,21 +110,19 @@ function BreathOfArmok(unit)
114110 local i
115111
116112 local count_max = count_this (df .job_skill )
117- utils = require ' utils'
118113 for i = 0 , count_max do
119114 utils .insert_or_update (unit .status .current_soul .skills , { new = true , id = i , rating = 20 }, ' id' )
120115 end
121116 print (" The breath of Armok has engulfed " .. unit .name .first_name )
122117end
123118-- ---------------------------------------------------------------------------
124119function LegendaryByClass (skilltype ,v )
125- unit = v
120+ local unit = v
126121 if unit == nil then
127122 print (" No unit available! Aborting with extreme prejudice." )
128123 return
129124 end
130125
131- utils = require ' utils'
132126 local i
133127 local skillclass
134128 local count_max = count_this (df .job_skill )
182176-- ---------------------------------------------------------------------------
183177-- main script operation starts here
184178-- ---------------------------------------------------------------------------
185- local opt = ...
179+ local args = {... }
180+ local opt = args [1 ]
186181local skillname
187182
188183if opt then
0 commit comments