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

fixes #6
This commit is contained in:
duncathan 2019-03-22 01:32:05 -06:00
parent 8f887748e1
commit 0bdbd5ca96
2 changed files with 11 additions and 8 deletions

View file

@ -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()

View file

@ -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()))