adds support for puppysanity to randomizer

This commit is contained in:
duncathan 2020-02-25 22:54:19 -06:00 committed by duncathan salt
parent 4b5b26824d
commit df3aff4628
3 changed files with 19 additions and 5 deletions

View file

@ -33,6 +33,7 @@ function C:new()
self.itemDeck = Items()
self.worldGraph = WorldGraph(self.itemDeck)
self.customseed = nil
self.puppy = false
end
function C:setPath(path)
@ -128,13 +129,22 @@ function C:_writePlaintext(tscFiles)
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(true)))
local optional = _.compact(_.shuffle(self.itemDeck:getOptionalItems(true)))
local puppies = _.compact(_.shuffle(self.itemDeck:getItemsByAttribute("puppy")))
if not self.puppy then
-- first fill puppies
self:_fastFillItems(puppies, _.shuffle(self.worldGraph:getPuppySpots()))
else
-- for puppysanity, shuffle puppies in with the mandatory items
mandatory = _.shuffle(_.append(mandatory, puppies))
end
-- 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])
-- next fill hell chests, which cannot have mandatory items
self:_fastFillItems(optional, _.shuffle(self.worldGraph:getHellSpots()))

View file

@ -28,6 +28,7 @@ layout.go:onPress(function()
if settings.seedselect.value and settings.customseed.value ~= "" then
Randomizer.customseed = settings.customseed.value
end
Randomizer.puppy = settings.puppy.value
C:setStatus(Randomizer:randomize())
Randomizer:new()
else

View file

@ -6,6 +6,9 @@ return { style = 'dialog',
{ type = 'radio', group = 'seed', text = 'Use random seed', value = true },
{ flow = 'y', { type = 'radio', group = 'seed', text = 'Use custom seed', id = 'seedselect'}, { type = 'text', id = 'customseed', width = 150 }, {height = false} }
},
{ type = 'label', text = 'Randomization Options' },
{ type = 'check', value = false, id = 'puppy', text = "Puppysanity"},
{ height = false },
},
{ style = 'dialogFoot',
{},