diff --git a/src/database/world_graph.lua b/src/database/world_graph.lua index 363e44d..b3feb92 100644 --- a/src/database/world_graph.lua +++ b/src/database/world_graph.lua @@ -15,7 +15,8 @@ function firstCave:new(worldGraph) self.locations = { firstCapsule = Location("First Cave Life Capsule", "Cave", "0401", self), gunsmithChest = Location("Hermit Gunsmith Chest", "Pole", "0202", self), - gunsmith = Location("Tetsuzou", "Pole", "0303", self) + gunsmith = Location("Tetsuzou", "Pole", "0303", self), + gameMode = Location("Game Mode Setup Script", "Start", "0201", self) } self.locations.gunsmith.requirements = function(self, items) @@ -441,6 +442,10 @@ function worldGraph:getLocations() return locations end +function worldGraph:getGameModeSpot() + return {self.regions.firstCave.locations.gameMode} +end + function worldGraph:getPuppySpots() return { self.regions.upperSandZone.locations.curly, diff --git a/src/randomizer.lua b/src/randomizer.lua index b404678..121cd16 100644 --- a/src/randomizer.lua +++ b/src/randomizer.lua @@ -34,6 +34,7 @@ function C:new() self.worldGraph = WorldGraph(self.itemDeck) self.customseed = nil self.puppy = false + self.game = "" end function C:setPath(path) @@ -128,7 +129,14 @@ function C:_writePlaintext(tscFiles) end end +function C:getGameMode() + return {self.itemDeck:getByKey(self.game)} +end + function C:_shuffleItems(tscFiles) + -- place the game mode scripts in Start Point + self:_fastFillItems(self:getGameMode(), self.worldGraph:getGameModeSpot()) + local mandatory = _.compact(_.shuffle(self.itemDeck:getMandatoryItems(true))) local optional = _.compact(_.shuffle(self.itemDeck:getOptionalItems(true))) local puppies = _.compact(_.shuffle(self.itemDeck:getItemsByAttribute("puppy"))) @@ -143,8 +151,6 @@ function C:_shuffleItems(tscFiles) -- 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())) diff --git a/src/ui/draw.lua b/src/ui/draw.lua index e7a40f8..02acadc 100644 --- a/src/ui/draw.lua +++ b/src/ui/draw.lua @@ -28,6 +28,17 @@ layout.go:onPress(function() if settings.seedselect.value and settings.customseed.value ~= "" then Randomizer.customseed = settings.customseed.value end + + if settings.bad.value then + Randomizer.game = "gameBadEnd" + else if settings.norm.value then + Randomizer.game = "gameNormalEnd" + else if settings.boss.value then + Randomizer.game = "gameAllBosses" + else + Randomizer.game = "gameBestEnd" + end + Randomizer.puppy = settings.puppy.value C:setStatus(Randomizer:randomize()) Randomizer:new() diff --git a/src/ui/settings.lua b/src/ui/settings.lua index 537b6e4..5c4409b 100644 --- a/src/ui/settings.lua +++ b/src/ui/settings.lua @@ -13,10 +13,10 @@ return { style = 'dialog', }, { { type = 'label', text = 'Objective' }, - { type = 'radio', group = 'objective', text = 'Bad ending' }, - { type = 'radio', group = 'objective', text = 'Normal ending' }, - { type = 'radio', group = 'objective', text = 'Best ending', value = true }, - { type = 'radio', group = 'objective', text = 'All bosses' }, + { type = 'radio', group = 'objective', text = 'Bad ending', id = 'bad' }, + { type = 'radio', group = 'objective', text = 'Normal ending', id = 'norm'}, + { type = 'radio', group = 'objective', text = 'Best ending', id = 'best', value = true }, + { type = 'radio', group = 'objective', text = 'All bosses', id = 'boss' }, }, }, { style = 'dialogFoot',