1) Fixed a dinv bug that could mistakenly skip valid equipment sets if your spellup gave stats

higher than the ceiling for equipment stats at the target level.  This could happen if you
   received an imm spellup or an SH spellup when you were at a low level.
master
Durel 7 years ago
parent 5fe9255137
commit 5d10ece125

@ -13851,7 +13851,9 @@ function inv.set.createCR()
newSet, stats, score = inv.set.createWithHandicap(priorityName, level, handicap) newSet, stats, score = inv.set.createWithHandicap(priorityName, level, handicap)
if (score > bestScore) then -- Update the set if we have a better score or if we don't have a valid score yet (we may as well put
-- something in the set so that we don't fail to create a set)
if (score > bestScore) or ((score == 0) and (bestScore == 0)) then
local wearLoc local wearLoc
local itemStruct local itemStruct
@ -13929,8 +13931,12 @@ function inv.set.createCR()
-- If our best set is empty (maybe we don't have anything in our inventory) then treat that as a -- If our best set is empty (maybe we don't have anything in our inventory) then treat that as a
-- special case and let the caller know about it -- special case and let the caller know about it
if (bestSet == nil) then if (bestSet == nil) then
dbot.warn("inv.set.createCR: No items in your inventory fit the set. Is your inventory empty?") dbot.warn("inv.set.createCR: No items in your inventory fit the set.")
dbot.warn("Do you need to refresh or build your inventory?") dbot.info("Possibility #1: You have not yet built your inventory table (see \"dinv help build\")")
dbot.info("Possibility #2: You need to refresh your inventory (see \"dinv help refresh\")")
dbot.info("Possibility #3: You aren\'t actually carrying anything that would go in the set")
dbot.info("Possibility #4: You have an awesome spellup that maxes your stats and none of your equipment adds anything your priority can use")
dbot.info("Possibility #5: There is a bug in dinv, but let\'s not go there...")
end -- if end -- if
-- Wait until the end to save the set (calling functions can know it isn't ready yet if it is nil) -- Wait until the end to save the set (calling functions can know it isn't ready yet if it is nil)
@ -16071,13 +16077,38 @@ function inv.statBonus.get(level, bonusType)
levelBonus = 200 levelBonus = 200
end -- if end -- if
inv.statBonus.equipBonus[level] = { int = levelBonus - spellBonus.int, local cappedInt = levelBonus - spellBonus.int
wis = levelBonus - spellBonus.wis, local cappedWis = levelBonus - spellBonus.wis
luck = levelBonus - spellBonus.luck, local cappedLuck = levelBonus - spellBonus.luck
str = levelBonus - spellBonus.str, local cappedStr = levelBonus - spellBonus.str
dex = levelBonus - spellBonus.dex, local cappedDex = levelBonus - spellBonus.dex
con = levelBonus - spellBonus.con } local cappedCon = levelBonus - spellBonus.con
if (cappedInt < 0) then
cappedInt = 0
end -- if
if (cappedWis < 0) then
cappedWis = 0
end -- if
if (cappedLuck < 0) then
cappedLuck = 0
end -- if
if (cappedStr < 0) then
cappedStr = 0
end -- if
if (cappedDex < 0) then
cappedDex = 0
end -- if
if (cappedCon < 0) then
cappedCon = 0
end -- if
inv.statBonus.equipBonus[level] = { int = cappedInt,
wis = cappedWis,
luck = cappedLuck,
str = cappedStr,
dex = cappedDex,
con = cappedCon }
return inv.statBonus.equipBonus[level], DRL_RET_SUCCESS return inv.statBonus.equipBonus[level], DRL_RET_SUCCESS

Loading…
Cancel
Save