From 008f8df01d7a1679f03a6e0d87204e69f5f8871f Mon Sep 17 00:00:00 2001 From: Zireael07 Date: Mon, 16 Sep 2013 15:21:41 +0200 Subject: [PATCH] fix #49 --- class/Player.lua | 190 ++++++++++++++++++++++++++++++++++++++++++++++- init.lua | 11 ++- 2 files changed, 194 insertions(+), 7 deletions(-) diff --git a/class/Player.lua b/class/Player.lua index 9db9e303..83e466c3 100644 --- a/class/Player.lua +++ b/class/Player.lua @@ -25,6 +25,7 @@ local Dialog = require "engine.Dialog" local DeathDialog = require "mod.dialogs.DeathDialog" local Astar = require"engine.Astar" local DirectPath = require "engine.DirectPath" +local NameGenerator = require "engine.NameGenerator" --- Defines the player -- It is a normal actor, with some redefined methods to handle user interaction.
@@ -57,7 +58,9 @@ function _M:init(t, no_default) self.lite = 0 --stealth test self.ecl = 1 - self.descriptor = {} + + self.descriptor = self.descriptor or {} + self.race = self.descriptor.race self.classes = self.classes or {} self.max_level = 50 self.max_exp = self.exp @@ -70,8 +73,193 @@ end function _M:onBirth() self:levelClass(self.descriptor.class) self:resetToFull() + self:randomName() +end + +function _M:randomName() +local random_name = { + human_male = { + syllablesStart ="Aeron, Courynn, Daelric, Dorn, Helm, Lynneth, Rowan, Sealmyd, Borivik, Fyodor, Vladislak, Khalid, Rasheed, Zasheir, Zasheira", + syllablesEnd ="Dulsaer, Jacerryl, Telstaer, Uthelienn, Pashar, Aporos, Nathos, Zora, Amblecrown, Duskman, Dundragon, Evenwood, Greycastle, Tallstag", + rules = "$s $e", + }, + human_female = { + syllablesStart ="Ariadne, Courynna, Daelra, Lynneth, Sealmyd, Smylla, Wydda, Fyevarra, Immith, Shevarra, Tammith, Katernin, Mara, Natali, Zofia, Jaheira, Zasheira", + syllablesEnd ="Dulsaer, Jacerryl, Telstaer, Uthelienn, Pashar, Aporos, Nathos, Zora, Amblecrown, Duskman, Dundragon, Evenwood, Greycastle, Tallstag", + rules = "$s $e", + }, + halfelf_male = { + syllablesStart ="Aeron, Courynn, Daelric, Dorn, Evendur, Helm, Lynneth, Rowan, Sealmyd, Khalid, Zasheir", + syllablesEnd ="Dulsaer, Jacerryl, Telstaer, Uthelienn, Pashar, Aporos, Nathos, Zora, Amblecrown, Duskman, Dundragon, Evenwood, Greycastle, Tallstag, Moonblade, Moonflower, Eveningstar", + rules = "$s$e", + }, + + halfelf_female = { + syllablesStart ="Ariadne, Courynna, Lynneth, Rowan, Sealmyd, Shandri, Smylla, Wydda, Fyevarra, Immith, Shevarra, Tammith, Katernin, Mara, Natali, Zofia, Jaheira", + syllablesEnd ="Dulsaer, Jacerryl, Telstaer, Uthelienn, Pashar, Aporos, Nathos, Zora, Amblecrown, Duskman, Dundragon, Evenwood, Greycastle, Tallstag, Moonblade, Moonflower, Eveningstar", + rules = "$s$e", + }, + + elf_male = { + syllablesStart ="Aravilar, Faelar, Saevel, Rhistel", + syllablesMiddle = "Moon, Evening", + syllablesEnd ="flower, blade, star, fall", + rules = "$s $m$e", + }, + + elf_female = { + syllablesStart ="Hacathra, Imizael, Talindra, Vestele", + syllablesMiddle = "Moon, Evening", + syllablesEnd ="flower, blade, star, fall", + rules = "$s $m$e", + }, + + halforc_male = { + syllablesStart ="Durth, Fang, Gothog, Harl, Orrusk, Orik, Thog", + syllablesEnd ="Horthor, Lammar, Turnskull, Ulkrunnar, Zorgar", + rules = "$s $e", + }, + + halforc_female = { + syllablesStart ="Orvaega, Duvaega, Varra", + syllablesEnd ="Horthor, Lammar, Turnskull, Ulkrunnar, Zorgar", + rules = "$s $e", + }, + + dwarf_male = { + syllablesStart ="Dorn, Khondar, Thorik", + syllablesMiddle = "Blade, Crown, Skull, Stone, Battle, Gold", + syllablesEnd ="bite, shield, dark", + rules = "$s $m$e", + }, + + dwarf_female = { + syllablesStart ="Belmara, Dorna", + syllablesMiddle = "Blade, Crown, Skull, Stone, Battle, Gold", + syllablesEnd ="bite, shield, dark", + rules = "$s $m$e", + }, + + drow_male = { + syllablesStart ="Alak, Drizzt, Ilmryn, Khalazza, Merinid, Mourn, Nym, Pharaun, Rizzen, Solaufein, Tebryn, Zaknafein", + syllablesMiddle = "", + syllablesEnd ="Abaeir, Baenre, Coloara, Glannath, Hune, Illistyn, Khalazza, Pharn, Seerear, Vrinn, Xiltyn", + rules = "$s $m$e", + }, + + drow_female = { + syllablesStart ="Akordia, Chalithra, Chalinthra, Eclavdra, Nedylene, Qilue, SiNafay", + syllablesMiddle = "", + syllablesEnd ="Abaeir, Baenre, Coloara, Glannath, Hune, Illistyn, Khalazza, Pharn, Seerear, Vrinn, Xiltyn", + rules = "$s $m$e", + }, + + duergar_male = { + syllablesStart = "Thorik, Dorn", + syllablesMiddle = "Blade, Crown, Skull, Stone, Battle, Dark", + syllablesEnd = "bite, shield, dark", + rules = "$s $m$e", + }, + + duergar_female = { + syllablesStart = "Belmara, Dorna", + syllablesMiddle = "Blade, Crown, Skull, Stone, Battle, Dark", + syllablesEnd = "bite, shield, dark", + rules = "$s $m$e", + }, + + gnome_male = { + syllablesStart = "Colmarr, Falrinn, Halbrinn", + syllablesMiddle = "Black, Great, Riven, White", + syllablesEnd = "orm, rock, stone, horn", + rules = "$s $m$e", + }, + gnome_female = { + syllablesStart = "Eliss, Lissa, Meree, Nathee", + syllablesMiddle = "Black, Great, Riven, White", + syllablesEnd = "orm, rock, stone, horn", + rules = "$s $m$e", + } +} + +--if self.descriptor.race then + if self.descriptor.race == "Human" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.human_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else local ng = NameGenerator.new(random_name.human_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Half-Elf" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.halfelf_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.halfelf_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Elf" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.elf_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.elf_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Half-Orc" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.halforc_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.halforc_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Dwarf" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.dwarf_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.dwarf_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Drow" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.drow_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.drow_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Duergar" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.duergar_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.duergar_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + elseif self.descriptor.race == "Deep gnome" then + if self.descriptor.sex == "Female" then + local ng = NameGenerator.new(random_name.gnome_female) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") + else + local ng = NameGenerator.new(random_name.gnome_male) + self:setName(ng:generate()) + print("GENERATING A RANDOM NAME") end + end +--end + end + function _M:getExpChart(level) if not level or level < 1 then return 0 end local ecl = self:attr("ecl") diff --git a/init.lua b/init.lua index 3907cd8d..724f56dd 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ --- ToME - Tales of Middle-Earth --- Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicolas Casalini +-- Veins of the Earth +-- Copyright (C) 2013 Zireael -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -13,22 +13,21 @@ -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . --- --- Nicolas Casalini "DarkGod" --- darkgod@te4.org name = "VotE" long_name = "The Veins of the Earth" short_name = "veins" author = { "Zireael", "x" } homepage = "https://github.com/Zireael07/The-Veins-of-the-Earth" -version = {0,0,8} +version = {0,0,12} engine = {1,0,4,"te4"} description = [[ In DarkGod's words, "a fantasy d20-themed dungeon crawler". ]] starter = "mod.load" +no_get_name = true + show_only_on_cheat = false -- Example modules are not shown to normal players score_formatters = {