diff --git a/scripts/eressea/cursed.lua b/scripts/eressea/cursed.lua new file mode 100644 index 000000000..795d7aeb3 --- /dev/null +++ b/scripts/eressea/cursed.lua @@ -0,0 +1,28 @@ +require 'bit32' + +local function curse(file) + for line in file:lines() do + f = get_faction(line) + if not f then + print("no such faction: " .. line) + elseif bit32.band(16, f.flags)==0 then + print("cursing " .. tostring(f)) + f.flags = f.flags + 16 + else + print("already cursed: " .. tostring(f)) + end + end +end + +local cursed = {} + +function cursed.init() + print("curses!") + local f = io.open("cursed.txt", "r") + if f then + print("found cursed.txt") + curse(f) + end +end + +return cursed diff --git a/scripts/eressea/e2/init.lua b/scripts/eressea/e2/init.lua index 581836147..2bdc79b64 100644 --- a/scripts/eressea/e2/init.lua +++ b/scripts/eressea/e2/init.lua @@ -14,5 +14,6 @@ return { require('eressea.astral'), require('eressea.locales'), require('eressea.jsreport'), - require('eressea.ents') + require('eressea.ents'), + require('eressea.cursed') }