PQ name gen, level up

I got interrupted while doing this days ago and forgot to commit
This commit is contained in:
2026-09-26 21:05:33 -06:00
parent 83b6ba1f72
commit 3498275bf0
2 changed files with 56 additions and 2 deletions
+8
View File
@@ -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
+48 -2
View File
@@ -19,12 +19,14 @@ local constants = require "data.constants"
local classes = require "data.classes"
local races = require "data.races"
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 = ""
@@ -41,7 +43,21 @@ 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
name = name or progress_quest_random_name() -- name not affected by seed
local seed = math.random()
math.randomseed(seed)
@@ -63,9 +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)
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 .. "!"