e2k9 lua script

race-limited weapons
This commit is contained in:
Enno Rehling 2009-06-03 21:57:56 +00:00
parent 0bdb05270e
commit a55871a6aa
7 changed files with 144 additions and 4 deletions

View File

@ -108,7 +108,7 @@
<param name="modules.astralspace" value="0"/> <param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/> <param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1/> <param name="modules.markets" value="1"/>
<param name="skills.cost" value="500"/> <param name="skills.cost" value="500"/>
<param name="entertain.base" value="0"/> <param name="entertain.base" value="0"/>
@ -139,7 +139,7 @@
<param name="rules.economy.herbrot" value="0"/> <param name="rules.economy.herbrot" value="0"/>
<param name="rules.give" value="11"/> <!-- only self + peasants + ondeath --> <param name="rules.give" value="11"/> <!-- only self + peasants + ondeath -->
<param name="rules.help.mask" value="fight guard money"/> <param name="rules.help.mask" value="fight guard money"/>
<param name="movement.shipspeed.skillbonus" value="7"/> <param name="movement.shipspeed.skillbonus" value="7"/>
<param name="alliance.auto" value="fight"/> <param name="alliance.auto" value="fight"/>
<!--param name="alliance.restricted" value="fight"/--> <!--param name="alliance.restricted" value="fight"/-->
</game> </game>

View File

@ -3,11 +3,14 @@
<resource name="towershield"> <resource name="towershield">
<item weight="200" score="60"> <item weight="200" score="60">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="armorer" minskill="6" reqsize="1"> <construction skill="armorer" minskill="6" reqsize="1">
<modifier function="mod_dwarves_only"/> <modifier function="mod_dwarves_only"/>
<requirement type="iron" quantity="2"/> <requirement type="iron" quantity="2"/>
</construction> </construction>
<armor ac="2" projectile="0.30" penalty="-0.10" magres="0.0" shield="yes" /> <armor ac="2" projectile="0.30" penalty="-0.10" magres="0.0" shield="yes">
<modifier type="canuse" function="mod_elves_only"/>
</armor>
</item> </item>
</resource> </resource>

View File

@ -42,6 +42,7 @@
<skill name="quarrying" modifier="1"/> <skill name="quarrying" modifier="1"/>
<skill name="riding" modifier="-99"/> <skill name="riding" modifier="-99"/>
<skill name="sailing" modifier="-1"/> <skill name="sailing" modifier="-1"/>
<skill name="spear" speed="+5"/>
<skill name="stamina" speed="0"/> <skill name="stamina" speed="0"/>
<skill name="shipcraft" modifier="-1"/> <skill name="shipcraft" modifier="-1"/>
<skill name="tactics" modifier="1"/> <skill name="tactics" modifier="1"/>

View File

@ -5,7 +5,7 @@
<xi:include href="../weapons/catapult.xml"/> <xi:include href="../weapons/catapult.xml"/>
<xi:include href="../weapons/crossbow.xml"/> <xi:include href="../weapons/crossbow.xml"/>
<xi:include href="../weapons/firesword.xml"/> <xi:include href="../weapons/firesword.xml"/>
<xi:include href="../weapons/greatbow.xml"/> <xi:include href="../weapons/greatbow-2.xml"/>
<xi:include href="../weapons/greatsword-2.xml"/> <xi:include href="../weapons/greatsword-2.xml"/>
<xi:include href="../weapons/halberd-2.xml"/> <xi:include href="../weapons/halberd-2.xml"/>
<xi:include href="../weapons/laensword.xml"/> <xi:include href="../weapons/laensword.xml"/>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- this has a lua canuse function -->
<resource name="greatbow">
<item weight="100">
<function name="canuse" value="lua_canuse_item"/>
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<modifier function="mod_elves_only"/>
<requirement type="mallorn" quantity="2"/>
</construction>
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0" magres="0.0">
<damage type="rider" value="2d6+4"/>
<damage type="footman" value="2d6+4"/>
<modifier type="missile_target" value="2"/>
<modifier type="damage" value="1">
<race name="elf"/>
</modifier>
</weapon>
</item>
</resource>

107
src/scripts/e2k9.lua Normal file
View File

@ -0,0 +1,107 @@
-- the locales that this gameworld supports.
local locales = { "de", "en" }
function loadscript(name)
local script = scriptpath .. "/" .. name
print("- loading " .. script)
if pcall(dofile, script)==0 then
print("Could not load " .. script)
end
end
loadscript("default.lua")
function change_locales()
-- local localechange = { }
local localechange = { de = { "rtph" } }
for loc, flist in pairs(localechange) do
for index, name in pairs(flist) do
f = get_faction(atoi36(name))
if f ~= nil then
f.locale = loc
print("LOCALECHANGE ", f, loc)
end
end
end
end
function load_scripts()
scripts = {
"spells.lua",
"extensions.lua",
"e2k9/items.lua"
}
for index, value in pairs(scripts) do
loadscript(value)
end
end
function process(orders)
-- initialize starting equipment for new players
if open_game(get_turn())~=0 then
print("could not read game")
return -1
end
init_summary()
-- kill multi-players (external script)
-- loadscript("eressea/multis.lua")
-- run the turn:
if read_orders(orders) ~= 0 then
print("could not read " .. orders)
return -1
end
plan_monsters()
local nmrs = get_nmrs(1)
if nmrs >= 80 then
print("Shit. More than 80 factions with 1 NMR (" .. nmrs .. ")")
write_summary()
return -1
end
print (nmrs .. " Factions with 1 NMR")
process_orders()
-- create new monsters:
spawn_dragons()
spawn_undead()
spawn_braineaters(0.25)
spawn_ents()
-- post-turn updates:
update_xmas2006()
update_embassies()
update_guards()
update_scores()
change_locales()
-- use newfactions file to place out new players
autoseed(basepath .. "/newfactions", false)
write_files(locales)
file = "" .. get_turn() .. ".dat"
if write_game(file, "binary")~=0 then
print("could not write game")
return -1
end
end
--
-- main body of script
--
-- orderfile: contains the name of the orders.
load_scripts()
if orderfile==nil then
print "you must specify an orderfile"
else
process(orderfile)
end

View File

@ -0,0 +1,10 @@
-- used internally to check greatbow and towershield
function item_canuse(u, iname)
if iname=="towershield" then
return u.race=="dwarf"
end
if iname=="greatbow" then
return u.race=="elf"
end
return true
end