Skip to content

Instantly share code, notes, and snippets.

@thistleknot
Last active December 20, 2015 14:19
Show Gist options
  • Save thistleknot/6146236 to your computer and use it in GitHub Desktop.
Save thistleknot/6146236 to your computer and use it in GitHub Desktop.
unit = dfhack.gui.getSelectedUnit()
PlusPlus = {700, 1200, 1400, 1500, 1600, 1800, 2500}
Plus = {450, 950, 1150, 1250, 1350, 1550, 2250}
Normal = {200, 700, 900, 1000, 1100, 1300, 2000}
Minus = {150, 600, 800, 900, 1000, 1100, 1500}
Mental_Attribute_Names = {
Mental_PlusPlus = {"FOCUS", "SPATIAL_SENSE"},
Mental_Plus = {"ANALYTICAL_ABILITY", "FOCUS", "CREATIVITY", "PATIENCE", "MEMORY"},
Mental_Normal = {"WILLPOWER", "INTUITION", "LINGUISTIC_ABILITY", "MUSICALITY", "KINESTHETIC_SENSE", "EMPATHY", "SOCIAL_AWARENESS"},
}
Physical_Attribute_Names = {
Physical_Plus = {"STRENGTH", "TOUGHNESS"},
Physical_Normal = {"ENDURANCE", "RECUPERATION", "DISEASE_RESISTANCE"},
Physical_Minus = {"AGILITY"}
}
P_Attributes = unit.body.physical_attrs
M_Attributes = unit.status.current_soul.mental_attrs
-- old
--[[
for i, v in ipairs(Physical_Plus) do
P_Attributes[v].value = Plus[7]
P_Attributes[v].max_value = Plus[7]*2
end
]]
-- new anUnusedId, nameTable in pairs(AtributeNames) do
-- Physical
for P_Range_Name, Value_Holder in pairs(Physical_Attribute_Names) do
for anUnusedId, v in ipairs(Value_Holder) do
if P_Range_Name == "Physical_Plus" then
P_Attributes[v].value = Plus[#Plus]
elseif P_Range_Name == "Physical_Normal" then
P_Attributes[v].value = Normal[#Normal]
elseif P_Range_Name == "Physical_Minus" then
P_Attributes[v].value = Minus[#Minus]
end
if P_Attributes[v].value*2 > 5000 then
P_Attributes[v].max_value = 5000
else
P_Attributes[v].max_value = P_Attributes[v].value*2
end
end
end
-- Mental
for M_Range_Name, Value_Holder in pairs(Mental_Attribute_Names) do
for anUnusedId, v in ipairs(Value_Holder) do
if M_Range_Name == "Mental_PlusPlus" then
M_Attributes[v].value = PlusPlus[#PlusPlus]
elseif M_Range_Name == "Mental_Plus" then
M_Attributes[v].value = Plus[#Plus]
elseif M_Range_Name == "Mental_Normal" then
M_Attributes[v].value = Normal[#Normal]
end
if M_Attributes[v].value*2 > 5000 then
M_Attributes[v].max_value = 5000
else
M_Attributes[v].max_value = M_Attributes[v].value*2
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment