v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Divine language/script
Jump to navigation
Jump to search
1languages.GEN_DIVINE=function()
2
3 local letters={}
4 letters.vowel={}
5 letters.cons={}
6 letters.vowel.COMMON_NUM=5
7 letters.vowel.NUM=35
8 letters.cons.COMMON_NUM=12
9 letters.cons.NUM=22
10 letters.vowel.lookup={
11 "a","e","i","o","u",
12 "ae","ai","ao","au","ea","ei","eo","eu","ia","ie","io","iu","oa","oe","oi","ou","ua","ue","ui","uo","ah","eh","ih","oh","uh","ay","ey","iy","oy","uy"
13 }
14 letters.cons.lookup={
15 "b","p","g","k","c","z","s","d","t","m","n","ng",
16 "v","f","w","h","j","l","r","q","x","y"
17 }
18
19 for k,v in pairs(letters) do
20 v.common={}
21 v.rare={}
22 for i=1,5 do
23 if trandom(5)~=0 then v.common[i]=v.lookup[trandom(v.COMMON_NUM)+1] else v.common[i]=v.lookup[trandom(v.NUM)+1] end
24 end
25 for i=1,15 do
26 v.rare[i]=v.lookup[trandom(v.NUM)+1]
27 end
28 end
29
30 local function letter(t)
31 if trandom(5)~=0 then
32 return pick_random(t.common)
33 else
34 return pick_random(t.rare)
35 end
36 end
37 local gen_divine={}
38 for k,v in ipairs(world.language.word) do
39 local str=""
40 if trandom(2)~=0 then
41 str=str..letter(letters.cons)
42 str=str..letter(letters.vowel)
43 else
44 str=str..letter(letters.vowel)
45 end
46 local num_letters=trandom(3)
47 str=str..letter(letters.cons)
48 if num_letters>0 then str=str..letter(letters.vowel) end
49 if num_letters>1 then str=str..letter(letters.cons) end
50 gen_divine[v.token]=str
51 end
52
53 return gen_divine
54end