Save mid-run

master
a327ex 2021-05-25 20:41:51 -03:00
parent 023cf595fe
commit 2a240d6f57
6 changed files with 41 additions and 20 deletions

View File

@ -333,6 +333,7 @@ function Arena:update(dt)
}
max_units = 7 + new_game_plus
main:add(BuyScreen'buy_screen')
system.save_run(0, gold, {}, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', 0, {}, passives)
end, text = Text({{text = '[wavy, bg]restarting...', font = pixul_font, alignment = 'center'}}, global_text_tags)}
end}
@ -430,6 +431,7 @@ function Arena:update(dt)
}
max_units = 7 + new_game_plus
main:add(BuyScreen'buy_screen')
system.save_run(0, gold, {}, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', 0, {}, passives)
end, text = Text({{text = '[wavy, bg]restarting...', font = pixul_font, alignment = 'center'}}, global_text_tags)}
end
@ -525,6 +527,7 @@ function Arena:quit()
}
max_units = 7 + new_game_plus
main:add(BuyScreen'buy_screen')
system.save_run(0, gold, {}, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', 0, {}, passives)
end, text = Text({{text = '[wavy, bg]restarting...', font = pixul_font, alignment = 'center'}}, global_text_tags)}
end}
@ -801,6 +804,7 @@ function Arena:die()
}
max_units = 7 + new_game_plus
main:add(BuyScreen'buy_screen')
system.save_run(0, gold, {}, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', 0, {}, passives)
end, text = Text({{text = '[wavy, bg]restarting...', font = pixul_font, alignment = 'center'}}, global_text_tags)}
end}
@ -876,6 +880,7 @@ function Arena:transition()
TransitionEffect{group = main.transitions, x = self.player.x, y = self.player.y, color = self.color, transition_action = function(t)
slow_amount = 1
main:add(BuyScreen'buy_screen')
system.save_run(self.level, gold, self.units, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', self.level, self.units, passives)
t.t:after(0.1, function()
t.text:set_text({

View File

@ -451,6 +451,7 @@ function RestartButton:update(dt)
max_units = 7 + new_game_plus
system.save_state()
main:add(BuyScreen'buy_screen')
system.save_run(0, gold, {}, passives, run_passive_pool_by_tiers)
main:go_to('buy_screen', 0, {}, passives)
end, text = Text({{text = '[wavy, bg]restarting...', font = pixul_font, alignment = 'center'}}, global_text_tags)}
end

View File

@ -397,6 +397,8 @@ function table.tostring(t)
end
if str ~= "{" then return str:sub(1, -3) .. "}"
else return str .. "}" end
elseif type(t) == "string" then
return '"' .. tostring(t) .. '"'
else return tostring(t) end
end

View File

@ -137,6 +137,20 @@ function system.load_state()
end
function system.save_run(level, gold, units, passives, run_passive_pool_by_tiers)
local run = {level = level, gold = gold, units = units, passives = passives, run_passive_pool_by_tiers = run_passive_pool_by_tiers}
local str = "return " .. table.tostring(run)
love.filesystem.write("run.txt", str)
end
function system.load_run()
local chunk = love.filesystem.load("run.txt")
if chunk then return chunk()
else return {} end
end
function system.get_main_directory()
return love.filesystem.getSource()
end

View File

@ -1157,15 +1157,16 @@ function init()
[25] = {'speed_booster', 'exploder', 'headbutter', 'tank', 'shooter', 'spawner'},
}
run_passive_pool_by_tiers = {
local run = system.load_run()
run_passive_pool_by_tiers = run.passive_pool_by_tiers or {
[1] = { 'wall_echo', 'wall_rider', 'centipede', 'temporal_chains', 'amplify', 'amplify_x', 'ballista', 'ballista_x', 'blunt_arrow', 'berserking', 'unwavering_stance', 'assassination', 'unleash', 'blessing',
'hex_master', 'force_push', 'spawning_pool'},
[2] = {'ouroboros_technique_r', 'ouroboros_technique_l', 'intimidation', 'vulnerability', 'resonance', 'point_blank', 'longshot', 'explosive_arrow', 'chronomancy', 'awakening', 'ultimatum', 'echo_barrage',
'reinforce', 'payback', 'whispers_of_doom', 'heavy_impact', 'immolation', 'call_of_the_void'},
[3] = {'divine_machine_arrow', 'divine_punishment', 'flying_daggers', 'crucio', 'hive', 'void_rift'},
}
gold = 2
passives = {}
gold = run.gold or 2
passives = run.passives or {}
steam.userStats.requestCurrentStats()
new_game_plus = state.new_game_plus or 0
if not state.new_game_plus then state.new_game_plus = new_game_plus end
@ -1173,10 +1174,12 @@ function init()
main = Main()
-- main_song_instance = _G[random:table{'song1', 'song2', 'song3', 'song4', 'song5'}]:play{volume = 0.5}
if run.level ~= 0 then
main_song_instance = _G[random:table{'song1', 'song2', 'song3', 'song4', 'song5'}]:play{volume = 0.5}
end
main:add(BuyScreen'buy_screen')
main:go_to('buy_screen', 0, {}, passives)
main:go_to('buy_screen', run.level or 0, run.units or {}, passives)
--[[
main:add(Arena'arena')

26
todo
View File

@ -1,15 +1,11 @@
* Lich buff -> increased projectile speed
* Highlander buff -> increased area size
* Change Cannoneer's Lv.3 to 7 repeats, and each repeat should be slightly slower *
* Wizard chains 3 times
* Saboteur area fix
* NG+ snake size fix
* Change Divine Machine Arrow to pierce 4 times
* Rogue buff -> chance to crit 15/30
* Psyker buff -> 10% bonus
* Concentrated Fire change to "chance to create secondary AoEs on AoE hit" (like Cannoneer's Lv.3)
* Decreased difficulty slightly for NG+ levels
* Remove repeat passives
* restart button on end game
* fixed interest above 5
* fixed fast passive buy bug
Curser buff - change all cursers to trigger like the infestor does and for the effects to be on-death effects
Forcer buff - change all forcers to have a bigger area or to trigger their effects via projectiles (like the hunter)
Conjurer buff - buff saboteur, buff engineer
Vagrant buff - increase "active set" bonuses
Save runs
Move units
Endless mode
Lock shop button
Harder difficulty on NG+0
Lower difficulty on NG+4/5
Increase boss HP on levels 24 and 25