Commit 0bdbd5ca authored by duncathan salt's avatar duncathan salt

minimizes failed seeds by placing a weaponSN in first cave before fill

fixes #6
parent 8f887748
......@@ -374,20 +374,21 @@ function C:getItems()
return self:_getItems(function(k,v) return true end)
end
function C:getItemsByAttribute(attribute)
return self:_getItems(function(k,v) return _.contains(v.attributes, attribute) end)
function C:getItemsByAttribute(attribute, onlyUnplaced)
onlyUnplaced = onlyUnplaced or false
return self:_getItems(function(k,v) return _.contains(v.attributes, attribute) and not (onlyUnplaced and v.placed) end)
end
function C:getEvents()
return self:getItemsByAttribute("event")
end
function C:getOptionalItems()
return self:getItemsByAttribute("nonProgressive")
function C:getOptionalItems(onlyUnplaced)
return self:getItemsByAttribute("nonProgressive", onlyUnplaced)
end
function C:getMandatoryItems()
return self:getItemsByAttribute("mandatory")
function C:getMandatoryItems(onlyUnplaced)
return self:getItemsByAttribute("mandatory", onlyUnplaced)
end
function C:getMandatory()
......
......@@ -103,9 +103,11 @@ end
function C:_shuffleItems(tscFiles)
-- first fill puppies
self:_fastFillItems(self.itemDeck:getItemsByAttribute("puppy"), _.shuffle(self.worldGraph:getPuppySpots()))
-- then fill one of the first cave spots with a weapon that can break blocks
_.shuffle(self.worldGraph:getFirstCaveSpots())[1]:setItem(_.shuffle(self.itemDeck:getItemsByAttribute("weaponSN"))[1])
local mandatory = _.compact(_.shuffle(self.itemDeck:getMandatoryItems()))
local optional = _.compact(_.shuffle(self.itemDeck:getOptionalItems()))
local mandatory = _.compact(_.shuffle(self.itemDeck:getMandatoryItems(true)))
local optional = _.compact(_.shuffle(self.itemDeck:getOptionalItems(true)))
-- next fill hell chests, which cannot have mandatory items
self:_fastFillItems(optional, _.shuffle(self.worldGraph:getHellSpots()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment