Compare commits
3
Commits
e40ffb91da
...
3498275bf0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3498275bf0 | ||
|
|
83b6ba1f72 | ||
|
|
d176ef90f8 |
No files matched your search
@@ -50,6 +50,14 @@ special characters:
|
||||
- Anti Juandez, who is made-up
|
||||
- Zargon
|
||||
|
||||
I want exploration, generated or discovered areas. And a map.
|
||||
|
||||
- [ ] fishing
|
||||
- [ ] Sims elements / life sim elements
|
||||
- [ ] mining
|
||||
- [ ] construction
|
||||
- [ ] agriculture
|
||||
|
||||
###### Prefixes
|
||||
Sick modifiers: dead, comatose, crippled, sick, undernourished
|
||||
Young: foetal, baby, preadolescent, teenage, underage
|
||||
|
||||
+1
-35
@@ -3,38 +3,4 @@ local utility = require "lib.utility"
|
||||
|
||||
local classes = utility.load_data("classes.json")
|
||||
|
||||
-- TODO abstract out since this is shared between classes and races
|
||||
local class_names = {}
|
||||
for name, data in pairs(classes) do
|
||||
class_names[#class_names + 1] = name
|
||||
|
||||
if type(data.tasks) == "string" then
|
||||
data.tasks = { data.tasks }
|
||||
elseif not data.tasks then
|
||||
data.tasks = {}
|
||||
end
|
||||
|
||||
local tasks = data.tasks
|
||||
for index, task in ipairs(tasks) do
|
||||
if type(task) == "string" then
|
||||
local time = #task * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task}
|
||||
elseif #task == 1 then
|
||||
local time = #task[1] * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[1]}
|
||||
elseif #task == 2 then
|
||||
local time = tasks[1]
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[2]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(class_names)
|
||||
|
||||
return {
|
||||
classes = classes,
|
||||
names = class_names,
|
||||
}
|
||||
return constants.fix_stats_tasks(classes)
|
||||
+40
-1
@@ -1,4 +1,43 @@
|
||||
return {
|
||||
local utility = require "lib.utility"
|
||||
|
||||
local constants = {
|
||||
progress_bar_height = 30,
|
||||
reading_time_multiplier = 1 / 9,
|
||||
}
|
||||
|
||||
constants.fix_stats_tasks = function(data)
|
||||
local result = {}
|
||||
for name, data in pairs(data) do
|
||||
result[name] = data
|
||||
result[#result + 1] = name
|
||||
|
||||
if type(data.tasks) == "string" then
|
||||
data.tasks = { data.tasks }
|
||||
elseif not data.tasks then
|
||||
data.tasks = {}
|
||||
end
|
||||
|
||||
local tasks = data.tasks
|
||||
for index, task in ipairs(tasks) do
|
||||
if type(task) == "string" then
|
||||
local time = #task * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task}
|
||||
elseif #task == 1 then
|
||||
local time = #task[1] * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[1]}
|
||||
elseif #task == 2 then
|
||||
local time = tasks[1]
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[2]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(result)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return constants
|
||||
+1
-35
@@ -3,38 +3,4 @@ local utility = require "lib.utility"
|
||||
|
||||
local races = utility.load_data("races.json")
|
||||
|
||||
-- TODO abstract out since this is shared between classes and races
|
||||
local race_names = {}
|
||||
for name, data in pairs(races) do
|
||||
race_names[#race_names + 1] = name
|
||||
|
||||
if type(data.tasks) == "string" then
|
||||
data.tasks = { data.tasks }
|
||||
elseif not data.tasks then
|
||||
data.tasks = {}
|
||||
end
|
||||
|
||||
local tasks = data.tasks
|
||||
for index, task in ipairs(tasks) do
|
||||
if type(task) == "string" then
|
||||
local time = #task * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task}
|
||||
elseif #task == 1 then
|
||||
local time = #task[1] * constants.reading_time_multiplier
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[1]}
|
||||
elseif #task == 2 then
|
||||
local time = tasks[1]
|
||||
-- TODO decide on a random amount of extra time to add
|
||||
tasks[index] = {time, time, task[2]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(race_names)
|
||||
|
||||
return {
|
||||
races = races,
|
||||
names = race_names,
|
||||
}
|
||||
return constants.fix_stats_tasks(races)
|
||||
@@ -0,0 +1,36 @@
|
||||
local log = require "lib.log"
|
||||
local utility = require "lib.utility"
|
||||
|
||||
local voices = utility.load_data("macos_say-en.json")
|
||||
|
||||
local say_thread = love.thread.newThread([[
|
||||
local channel = love.thread.getChannel("say")
|
||||
while true do
|
||||
local message = channel:demand()
|
||||
if message then
|
||||
os.execute("say -v " .. message.voice .. " " .. message.line)
|
||||
end
|
||||
end
|
||||
]])
|
||||
say_thread:start()
|
||||
|
||||
return setmetatable({
|
||||
update = function()
|
||||
local thread_error = say_thread:getError()
|
||||
if thread_error then
|
||||
log("error", thread_error)
|
||||
end
|
||||
end,
|
||||
}, {
|
||||
__call = function(self, line)
|
||||
local selected_voice = voices[math.random(1, #voices)]
|
||||
|
||||
local say_channel = love.thread.getChannel("say")
|
||||
line = line or "Hello, my name is " .. selected_voice .. "."
|
||||
say_channel:push({
|
||||
voice = selected_voice:enquote(),
|
||||
line = line:enquote(),
|
||||
})
|
||||
log("say", selected_voice, line)
|
||||
end,
|
||||
})
|
||||
+51
-33
@@ -2,6 +2,7 @@ local window_width, window_height = love.graphics.getDimensions()
|
||||
|
||||
local log = require "lib.log"
|
||||
local lovebird = require "lib.lovebird"
|
||||
local macOS_say = require "lib.macOS_say"
|
||||
local progress_bar = require "lib.progress_bar"
|
||||
local timer = require "lib.timer"
|
||||
local utility = require "lib.utility"
|
||||
@@ -18,37 +19,14 @@ local constants = require "data.constants"
|
||||
local classes = require "data.classes"
|
||||
local races = require "data.races"
|
||||
|
||||
local voices = utility.load_data("macos_say-en.json")
|
||||
local macOS_say = function(line)
|
||||
local selected_voice = voices[math.random(1, #voices)]
|
||||
|
||||
local say_channel = love.thread.getChannel("say")
|
||||
line = line or "Hello, my name is " .. selected_voice .. "."
|
||||
say_channel:push({
|
||||
voice = selected_voice:enquote(),
|
||||
line = line:enquote(),
|
||||
})
|
||||
log("say", selected_voice, line)
|
||||
end
|
||||
-- macOS_say()
|
||||
|
||||
local say_thread = love.thread.newThread([[
|
||||
local channel = love.thread.getChannel("say")
|
||||
while true do
|
||||
local message = channel:demand()
|
||||
if message then
|
||||
os.execute("say -v " .. message.voice .. " " .. message.line)
|
||||
end
|
||||
end
|
||||
]])
|
||||
say_thread:start()
|
||||
|
||||
local new_character = function(name)
|
||||
local base_stat_roll = function()
|
||||
return 3 + math.random(1, 6) + math.random(1, 6) + math.random(1, 6)
|
||||
end
|
||||
|
||||
local random_name = function(length)
|
||||
local naive_random_name = function(length)
|
||||
local vowels = "aaeeeiioouuy"
|
||||
local consonants = "bcdfghjklmnpqrstvwxyz"
|
||||
local text = ""
|
||||
@@ -65,16 +43,30 @@ local new_character = function(name)
|
||||
return text
|
||||
end
|
||||
|
||||
name = name or random_name(math.random(3, 9)) -- name not affected by seed
|
||||
local progress_quest_random_name = function()
|
||||
local parts = {
|
||||
("br|cr|dr|fr|gr|j|kr|l|m|n|pr||||r|sh|tr|v|wh|x|y|z"):split("|"),
|
||||
("a|a|e|e|i|i|o|o|u|u|ae|ie|oo|ou"):split("|"),
|
||||
("b|ck|d|g|k|m|n|p|t|v|x|z"):split("|"),
|
||||
}
|
||||
local name = ""
|
||||
for i = 0, 5 do
|
||||
local part = parts[i % 3 + 1]
|
||||
name = name .. part[math.random(1, #part)]
|
||||
end
|
||||
return name
|
||||
end
|
||||
|
||||
local seed = os.time()
|
||||
name = name or progress_quest_random_name() -- name not affected by seed
|
||||
|
||||
local seed = math.random()
|
||||
math.randomseed(seed)
|
||||
|
||||
local character = {
|
||||
seed = seed,
|
||||
name = name,
|
||||
race = races.names[math.random(1, #races.names)],
|
||||
class = classes.names[math.random(1, #classes.names)],
|
||||
race = races[math.random(1, #races)],
|
||||
class = classes[math.random(1, #classes)],
|
||||
charisma = base_stat_roll(),
|
||||
constitution = base_stat_roll(),
|
||||
dexterity = base_stat_roll(),
|
||||
@@ -87,10 +79,39 @@ local new_character = function(name)
|
||||
character.health = math.random(1, 8) + math.floor(character.constitution / 6)
|
||||
character.magic = math.random(1, 8) + math.floor(character.intelligence / 6)
|
||||
|
||||
math.randomseed(os.time())
|
||||
for _, stat_name in ipairs(races[character.race].stats) do
|
||||
character[stat_name] = character[stat_name] + math.random(1, 3)
|
||||
end
|
||||
for _, stat_name in ipairs(classes[character.class].stats) do
|
||||
character[stat_name] = character[stat_name] + math.random(1, 3)
|
||||
end
|
||||
|
||||
character.max_encumberance = character.strength + 10
|
||||
character.inventory = {}
|
||||
|
||||
return character
|
||||
end
|
||||
|
||||
local level_up = function(character)
|
||||
local random_stat_up = function(character)
|
||||
local core_stats = {
|
||||
"charisma", "constitution", "dexterity", "intelligence", "strength", "wisdom",
|
||||
}
|
||||
local selected_stat = core_stats[math.random(1, #core_stats)]
|
||||
character[selected_stat] = character[selected_stat] + 1
|
||||
end
|
||||
|
||||
character.health = character.health + 1 + math.floor(character.constitution / 3) + math.random(1, 4)
|
||||
character.magic = character.magic + 1 + math.floor(character.intelligence / 3) + math.random(1, 4)
|
||||
|
||||
random_stat_up(character)
|
||||
random_stat_up(character)
|
||||
|
||||
character.max_encumberance = character.strength + 10
|
||||
|
||||
-- TODO this is where a spell could be added, and
|
||||
end
|
||||
|
||||
local test_new_character = function()
|
||||
local character = new_character()
|
||||
local message = "My name is " .. character.name .. ", and I am a " .. character.class .. " " .. character.race .. "!"
|
||||
@@ -131,10 +152,7 @@ love.update = function(dt)
|
||||
|
||||
test_bar:set_progress(test_timer.run_time / test_timer:get_interval())
|
||||
|
||||
local thread_error = say_thread:getError()
|
||||
if thread_error then
|
||||
log("error", thread_error)
|
||||
end
|
||||
macOS_say:update()
|
||||
end
|
||||
|
||||
love.draw = function()
|
||||
|
||||
Reference in new issue
Block a user