mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-10 00:45:15 +00:00
minimizes failed seeds by placing a weaponSN in first cave before fill
fixes #6
This commit is contained in:
parent
8f887748e1
commit
0bdbd5ca96
|
@ -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()))
|
||||
|
|
Loading…
Reference in a new issue