factions.lua
4.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009 - 2015 Nicolas Casalini
--
-- 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
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
-- CSV export
local src = [[
,Enemies,Undead,Allied Kingdoms,Shalore,Thalore,Iron Throne,The Way,Angolwen,Keepers of Reality,Dreadfell,,Temple of Creation|H,Water lair|H,Assassin lair|H,Rhalore,Zigur,,Vargh Republic,Sunwall,Orc Pride,,Sandworm Burrowers,Victim,Slavers,,Sorcerers,Fearscape,,Sher'Tul,Cosmic Fauna,Horrors
Enemies,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Undead,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Allied Kingdoms,-1,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Shalore,-1,-1,0.5,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Thalore,-1,-1,0.7,0.2,,,,,,,,,,,,,,,,,,,,,,,,,,,
Iron Throne,-1,-1,0.2,0.2,0.2,,,,,,,,,,,,,,,,,,,,,,,,,,
The Way,-1,-1,0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,
Angol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1,-1,-1,-1,-1,-1,-1,-1,,-1,-1,-1,-1,-1,,-1,-1,-1,,-1,-1,-1,,-1,-1,,-1,,
Horrors,,-1,-1,-1,-1,-1,-1,-1,-1,,,-1,-1,-1,-1,-1,,-1,-1,-1,,,-1,-1,,-1,-1,,,-1,
]]
local facts = {}
local factsid = {}
local lines = src:split("\n")
for i, line in ipairs(lines) do
local data = line:split(",")
for j, d in ipairs(data) do
if i == 1 then
if d ~= "" then
local def = d:split("|")
local on_attack = false
for z = 2, #def do if def[z] == "H" then on_attack = true end end
local sn = engine.Faction:add{ name=def[1], reaction={}, hostile_on_attack=on_attack }
print("[FACTION] added", sn, def[1])
facts[sn] = {id=j, reactions={}}
factsid[j] = sn
end
else
local n = tonumber(d)
if n then
facts[factsid[j]].reactions[factsid[i]] = n * 100
end
end
end
end
for f1, data in pairs(facts) do
for f2, v in pairs(data.reactions) do
-- print("[FACTION] initial reaction", f1, f2, " => ", v)
engine.Faction:setInitialReaction(f1, f2, v, true)
end
end
engine.Faction:add{ name="Neutral", reaction={}, }
engine.Faction:setInitialReaction("neutral", "enemies", -100, true)
engine.Faction:add{ name="Unaligned", reaction={}, }
engine.Faction:add{ shortname="merchant-caravan", name="Merchant Caravan", reaction={}, }
engine.Faction:add{ name="Point Zero Onslaught", reaction={}, }
engine.Faction:add{ name="Point Zero Guardians", reaction={}, }
engine.Faction:setInitialReaction("point-zero-onslaught", "point-zero-guardians", -100, true)
engine.Faction:setInitialReaction("enemies", "point-zero-guardians", -100, true)
engine.Faction:setInitialReaction("keepers-of-reality", "point-zero-guardians", 100, true)