mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-22 14:53:00 +00:00
generation works!
This commit is contained in:
parent
ed6234a1c0
commit
523fe7ef65
|
@ -88,17 +88,17 @@ local function _itemData()
|
|||
machineGun = {
|
||||
name = "Machine Gun",
|
||||
script = "<EVE0008",
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "flight", "mandatory"}
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "flight", "mandatory", "weaponStrong"}
|
||||
},
|
||||
blade = {
|
||||
name = "Blade",
|
||||
script = "<EVE0009",
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "mandatory"}
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "mandatory", "weaponStrong"}
|
||||
},
|
||||
nemesis = {
|
||||
name = "Nemesis",
|
||||
script = "<EVE0010",
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "nonProgressive"}
|
||||
attributes = {"weapon", "weaponBoss", "weaponSN", "nonProgressive", "weaponStrong"}
|
||||
},
|
||||
|
||||
---------------
|
||||
|
|
|
@ -273,7 +273,7 @@ function labyrinthB:new(worldGraph)
|
|||
if self.world:StartPoint() or self.world:Arthur() then
|
||||
return self.world.regions.arthur:canAccess(items)
|
||||
elseif self.world:Camp() then
|
||||
return self.world.regions.labyrinthB:canAccess(items) and _has("weaponBoss")
|
||||
return self.world.regions.labyrinthW:canAccess(items) and _has(items, "weaponBoss")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -490,6 +490,10 @@ function worldGraph:getMALCO()
|
|||
return {self.regions.grasstownEast.locations.malco}
|
||||
end
|
||||
|
||||
function worldGraph:getDrGero()
|
||||
return {self.regions.labyrinthW.locations.physician}
|
||||
end
|
||||
|
||||
function worldGraph:getPuppySpots()
|
||||
return {
|
||||
self.regions.upperSandZone.locations.curly,
|
||||
|
|
|
@ -305,24 +305,39 @@ function C:_updateSettings()
|
|||
Settings.settings.puppy = self.puppy
|
||||
Settings.settings.obj = self.obj
|
||||
Settings.settings.mychar = self.mychar
|
||||
Settings.settings.spawn = self.worldGraph.spawn
|
||||
Settings:update()
|
||||
end
|
||||
|
||||
function C:_updateSharecode(seed)
|
||||
local settings = 0 -- 0b00000000
|
||||
-- 0bXXXXXPOO
|
||||
-- 0bXXXSSPOO
|
||||
-- P: single bit used for puppysanity
|
||||
-- O: two bits used for objective
|
||||
-- S: two bits used for spawn location
|
||||
-- X: unused
|
||||
|
||||
-- bitshift intervals
|
||||
local obj = 0
|
||||
local pup = 2
|
||||
local spn = 3
|
||||
|
||||
if self.obj == "objBadEnd" then
|
||||
settings = bit.bor(settings, 1)
|
||||
settings = bit.bor(settings, bit.blshift(1, obj))
|
||||
elseif self.obj == "objNormalEnd" then
|
||||
settings = bit.bor(settings, 2)
|
||||
settings = bit.bor(settings, bit.blshift(2, obj))
|
||||
elseif self.obj == "objAllBosses" then
|
||||
settings = bit.bor(settings, 3)
|
||||
settings = bit.bor(settings, bit.blshift(3, obj))
|
||||
end
|
||||
if self.puppy then settings = bit.bor(settings, bit.blshift(1, pup)) end
|
||||
|
||||
if self.worldGraph:StartPoint() then
|
||||
settings = bit.bor(settings, bit.blshift(0, spn))
|
||||
elseif self.worldGraph:Arthur() then
|
||||
settings = bit.bor(settings, bit.blshift(1, spn))
|
||||
elseif self.worldGraph:Camp() then
|
||||
settings = bit.bor(settings, bit.blshift(2, spn))
|
||||
end
|
||||
if self.puppy then settings = bit.bor(settings, 4) end
|
||||
|
||||
if #seed < 20 then
|
||||
seed = seed .. (" "):rep(20-#seed)
|
||||
|
|
|
@ -12,6 +12,7 @@ function C:setDefaults()
|
|||
self.settings.csdirectory = nil
|
||||
self.settings.puppy = false
|
||||
self.settings.obj = "objBestEnd"
|
||||
self.settings.spawn = "Start Point"
|
||||
self:update()
|
||||
end
|
||||
|
||||
|
@ -26,6 +27,7 @@ function C:serialize()
|
|||
line = line .. ("puppy = %s,\r\n "):format(self.settings.puppy)
|
||||
line = line .. ("obj = %q,\r\n "):format(self.settings.obj or "")
|
||||
line = line .. ("mychar = %q,\r\n "):format(self.settings.mychar or "")
|
||||
line = line .. ("spawn = %q,\r\n "):format(self.settings.spawn or "")
|
||||
|
||||
line = line .. "\r\n}"
|
||||
return line
|
||||
|
|
|
@ -12,7 +12,7 @@ layout:setTheme(require 'lib.luigi.theme.dark')
|
|||
settings:setTheme(require 'lib.luigi.theme.dark')
|
||||
|
||||
function C:setup()
|
||||
self:loadSettings(Settings.settings.puppy, Settings.settings.obj, nil, Settings.settings.mychar)
|
||||
self:loadSettings(Settings.settings.puppy, Settings.settings.obj, nil, Settings.settings.mychar, Settings.settings.spawn)
|
||||
|
||||
background = lg.newImage('assets/background.png')
|
||||
self:draw()
|
||||
|
@ -56,11 +56,11 @@ function C:loadSettings(puppy, obj, seed, mychar, spawn)
|
|||
end
|
||||
settings.mychar.value = "override"
|
||||
|
||||
if spawn == "Start Point" then
|
||||
if spawn == "Start Point" or spawn == 0 then
|
||||
settings.spawn.index = 1
|
||||
elseif spawn == "Arthur's House" then
|
||||
elseif spawn == "Arthur's House" or spawn == 1 then
|
||||
settings.spawn.index = 2
|
||||
elseif spawn == "Camp" then
|
||||
elseif spawn == "Camp" or spawn == 2 then
|
||||
settings.spawn.index = 3
|
||||
end
|
||||
settings.spawn.value = "override"
|
||||
|
@ -129,8 +129,9 @@ settings.importshare:onPress(function()
|
|||
settings.importshare.text = "Sharecode Imported"
|
||||
local pup = bit.band(sharesettings, 4) ~= 0
|
||||
local obj = bit.band(sharesettings, 3)
|
||||
local spn = bit.brshift(bit.band(sharesettings, 24), 3)
|
||||
seed = seed:gsub("^%s*(.-)%s*$", "%1") -- trim any leading or trailing whitespace
|
||||
Screen:loadSettings(pup, obj, seed)
|
||||
Screen:loadSettings(pup, obj, seed, nil, spn)
|
||||
else
|
||||
settings.importshare.text = "Invalid Sharecode!"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue