Merge remote-tracking branch 'upstream/develop'

This commit is contained in:
CTD 2015-10-01 14:08:20 +02:00
commit 300608586f
274 changed files with 7935 additions and 6373 deletions

8
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.orig
eressea.ini
Debug
Release
@ -18,7 +19,6 @@ ipch/
*.opensdf
*.pdb
*.sdf
*.sh
*.suo
*.user
@ -37,3 +37,9 @@ game-e3/reports/
tags
Thumbs.db
.gdb_history
*.cfg
*.cmd
tmp/
tests/config.lua
tests/reports/
tests/data/185.dat

23
.gitmodules vendored
View File

@ -1,31 +1,34 @@
[submodule "lunit"]
path = lunit
url = git://github.com/badgerman/lunit.git
url = git://github.com/ennorehling/lunit.git
[submodule "crypto"]
path = crypto
url = git://github.com/badgerman/crypto.git
url = git://github.com/ennorehling/crypto.git
[submodule "cmake"]
path = cmake
url = git://github.com/badgerman/cmake.git
url = git://github.com/ennorehling/cmake.git
[submodule "quicklist"]
path = quicklist
url = git://github.com/badgerman/quicklist.git
url = git://github.com/ennorehling/quicklist.git
[submodule "critbit"]
path = critbit
url = git://github.com/badgerman/critbit.git
url = git://github.com/ennorehling/critbit.git
[submodule "dlmalloc"]
path = dlmalloc
url = git://github.com/badgerman/dlmalloc.git
url = git://github.com/ennorehling/dlmalloc.git
[submodule "cutest"]
path = cutest
url = git://github.com/badgerman/cutest.git
url = git://github.com/ennorehling/cutest.git
[submodule "iniparser"]
path = iniparser
url = git://github.com/badgerman/iniparser.git
url = git://github.com/ennorehling/iniparser.git
[submodule "cJSON"]
path = cJSON
url = git://github.com/badgerman/cJSON.git
url = git://github.com/ennorehling/cJSON.git
[submodule "storage"]
path = storage
url = git://github.com/badgerman/storage.git
url = git://github.com/ennorehling/storage.git
branch = master
[submodule "tolua"]
path = tolua
url = git://github.com/ennorehling/tolua.git

View File

@ -1,11 +1,19 @@
sudo: false
language: c
compiler:
- gcc
- clang
script: s/travis-build
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq zlib1g-dev libtolua-dev liblua5.1-dev libncurses5-dev libsqlite3-dev libxml2-dev valgrind
addons:
apt:
packages:
- liblua5.2-dev
- libncurses5-dev
- libsqlite3-dev
- libxml2-dev
- valgrind
os:
- linux
- osx
notifications:
slack:
secure: F89aXLWaE125PaJIlETv12jT4EfH6wLXJmGCPZzrN3OcLn2ahDWqjwuzR7lOEDf2nAISmeMPyDZMhEHXLNHAE5qP6lg9yliYQw5hzGmDK9m1xUq/pPEne/b2Y7K3my1mkRZ6n3asbHgSmBWAfCIk1JN8R5Rv+rmbLuWLc+zofts=

View File

@ -8,6 +8,11 @@ project (eressea-server C)
enable_testing()
find_package (LibXml2)
find_package (SQLite3)
find_package (Curses)
find_package (Lua REQUIRED)
find_package (ToLua REQUIRED)
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckSymbolExists)
@ -57,13 +62,6 @@ CONFIGURE_FILE (
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
find_package (LibXml2)
find_package (SQLite3)
find_package (Curses)
find_package (Lua REQUIRED)
find_package (ToLua REQUIRED)
add_subdirectory (cutest)
add_subdirectory (crypto)
add_subdirectory (cJSON)
@ -75,4 +73,4 @@ add_subdirectory (src eressea)
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json")
install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@ -1,5 +1,9 @@
all:
@echo "Please use the cmake build system by running configure"
s/build
test:
s/runtests
clean:
@rm -f *.log.*
@find . -name "*~" | xargs rm -f

2
cmake

@ -1 +1 @@
Subproject commit cd779ba36efb4045a040af170588a8dfe496d7b9
Subproject commit f1fb3943ace59994d90d71a891b80033dc2700a2

View File

@ -1,5 +1,40 @@
{
"include": [
"keywords.json"
]
"keywords.json",
"prefixes.json",
"e2/terrains.json"
],
"disabled": [
"pay",
"jsreport"
],
"settings": {
"game.id": 2,
"game.name": "Eressea",
"NewbieImmunity": 8,
"modules.wormholes": true,
"entertain.base": 0,
"entertain.perlevel": 20,
"nmr.timeout": 5,
"nmr.removenewbie": 0,
"GiveRestriction": 3,
"hunger.long": true,
"init_spells": 0,
"world.era": 2,
"seed.population.min": 8,
"seed.population.max": 8,
"rules.ship.damage_drift": 0.00,
"rules.reserve.twophase": true,
"rules.give.max_men": -1,
"rules.check_overload": false,
"rules.limit.faction": 2500,
"rules.maxskills.magic": 5,
"rules.guard.base_stop_prob": 0.30,
"rules.guard.skill_stop_prob": 0.05,
"rules.guard.amulet_stop_prob": 0.10,
"rules.guard.guard_number_stop_prob": 0.001,
"rules.guard.castle_stop_prob": 0.05,
"rules.guard.region_type_stop_prob": 0.05,
"rules.economy.repopulate_maximum": 500
}
}

View File

@ -16,12 +16,9 @@
<xi:include href="config://core/common/potions.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://game/races.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/ships.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
<xi:include href="config://core/terrains.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://game/artrewards.xml"/>
<xi:include href="config://game/buildings.xml"/>
<xi:include href="config://core/calendar.xml"/>
@ -33,10 +30,17 @@
<xi:include href="config://default/adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="30"/>
<item name="stone" amount="30"/>
<item name="money" amount="4200"/>
<item name="log" amount="50"/>
<item name="stone" amount="50"/>
<item name="iron" amount="50"/>
<item name="laen" amount="10"/>
<item name="sword" amount="1"/>
<item name="mallorn" amount="10"/>
<item name="skillpotion" amount="5"/>
<item name="p2" amount="5"/>
<item name="money" amount="20000"/>
<skill name="perception" level="30"/>
<skill name="melee" level="1"/>
</set>
<set name="new_faction">
<item name="adamantium" amount="1"/>
@ -48,70 +52,6 @@
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="Eressea">
<!-- Game specific settings -->
<order name="pay" disable="yes"/>
<skill name="alchemy" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="trade" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="herbalism" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="training" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="armorer" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="espionage" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="stealth" enable="true"/>
<skill name="entertainment" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="perception" enable="true"/>
<skill name="taxation" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="unarmed" enable="true"/>
<param name="NewbieImmunity" value="8"/>
<param name="modules.wormholes" value="1"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="10"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="init_spells" value="0"/>
<param name="world.era" value="2"/>
<param name="seed.population.min" value="8"/>
<param name="seed.population.max" value="8"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="1"/>
<param name="rules.give.max_men" value="-1"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.limit.faction" value="2500"/>
<param name="rules.maxskills.magic" value="5"/>
<param name="rules.guard.base_stop_prob" value="0.30"/>
<param name="rules.guard.skill_stop_prob" value="0.05"/>
<param name="rules.guard.amulet_stop_prob" value="0.10"/>
<param name="rules.guard.guard_number_stop_prob" value="0.001"/>
<param name="rules.guard.castle_stop_prob" value="0.05"/>
<param name="rules.guard.region_type_stop_prob" value="0.05"/>
<param name="rules.economy.repopulate_maximum" value="500"/>
<param name="game.id" value="2"/>
<param name="game.name" value="Eressea"/>
</game>
<strings>
<string name="mailto">
<text locale="de">eressea-server@eressea.de</text>

296
conf/e2/terrains.json Normal file
View File

@ -0,0 +1,296 @@
{
"terrains": {
"ocean": {
"size": 100,
"flags": [ "swim", "sea", "sail", "fly" ]
},
"plain": {
"size": 10000,
"herbs": [ "h0", "h1", "h2", "h3", "h4", "h5" ],
"seed": 3,
"road": 50,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.1,
"base": "5d8",
"div": "2d20+10",
"level": "2d4-1"
},
"stone": {
"chance": 0.15,
"base": "5d8",
"div": "2d30+20",
"level": "1d4"
},
"laen": {
"chance": 0.01,
"base": "1d4",
"div": "2d20+50",
"level": "1d4"
}
}
},
"swamp": {
"size": 2000,
"herbs": [ "h6", "h7", "h8" ],
"seed": 2,
"road": 75,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.02,
"base": "5d8",
"div": "2d20+10",
"level": "2d4-1"
},
"stone": {
"chance": 0.02,
"base": "5d8",
"div": "2d30+20",
"level": "1d4"
},
"laen": {
"chance": 0.02,
"base": "1d4",
"div": "2d20+50",
"level": "1d4"
}
}
},
"desert": {
"size": 500,
"herbs": [ "h9", "h10", "h11" ],
"seed": 2,
"road": 100,
"flags": [ "land", "walk", "sail", "fly", "cavalry" ],
"production": {
"iron": {
"chance": 0.15,
"base": "5d8",
"div": "2d20+10",
"level": "2d4-1"
},
"stone": {
"chance": 0.25,
"base": "5d8",
"div": "2d30+20",
"level": "1d4"
},
"laen": {
"chance": 0.025,
"base": "1d4",
"div": "2d20+50",
"level": "1d4"
}
}
},
"highland": {
"size": 4000,
"herbs": [ "h12", "h13", "h14" ],
"seed": 2,
"road": 100,
"flags": [ "land", "walk", "sail", "fly", "cavalry" ],
"production": {
"iron": {
"chance": 0.15,
"base": "5d8",
"div": "2d20+10",
"level": "2d4-1"
},
"stone": {
"chance": 0.25,
"base": "5d8",
"div": "2d30+20",
"level": "1d4"
},
"laen": {
"chance": 0.025,
"base": "1d4",
"div": "2d20+50",
"level": "1d4"
}
}
},
"mountain": {
"size": 1000,
"herbs": [ "h15", "h16", "h17" ],
"seed": 2,
"road": 250,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 1.0,
"base": "50",
"div": "50",
"level": "1"
},
"stone": {
"chance": 1.0,
"base": "100",
"div": "100",
"level": "1"
},
"laen": {
"chance": 0.05,
"base": "4",
"div": "100",
"level": "1"
}
}
},
"glacier": {
"size": 100,
"herbs": [ "h15", "h16", "h17" ],
"seed": 2,
"road": 250,
"flags": [ "arctic", "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 1.0,
"base": "3",
"div": "50",
"level": "1"
},
"stone": {
"chance": 1.0,
"base": "2",
"div": "100",
"level": "1"
},
"laen": {
"chance": 0.05,
"base": "4",
"div": "100",
"level": "1"
}
}
},
"iceberg": {
"size": 100,
"herbs": [ "h18", "h19", "h20" ],
"flags": [ "arctic", "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.9,
"base": "3",
"div": "50",
"level": "1"
},
"stone": {
"chance": 0.9,
"base": "2",
"div": "100",
"level": "1"
}
}
},
"iceberg_sleep": {
"size": 100,
"herbs": [ "h18", "h19", "h20" ],
"flags": [ "arctic", "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.9,
"base": "3",
"div": "50",
"level": "1"
},
"stone": {
"chance": 0.9,
"base": "2",
"div": "100",
"level": "1"
},
"laen": {
"chance": 0.05,
"base": "4",
"div": "100",
"level": "1"
}
}
},
"firewall": {
"size": 100,
"road": 250,
"flags": [ "forbidden" ]
},
"fog": {
"flags": [ "walk", "fly" ]
},
"thickfog": {
"flags": [ "forbidden" ]
},
"volcano": {
"size": 500,
"road": 250,
"seed": 1,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.5,
"level": "1",
"base": "50",
"div": "50"
},
"stone": {
"chance": 0.5,
"level": "1",
"base": "100",
"div": "100"
},
"laen": {
"chance": 0.075,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"activevolcano": {
"size": 500,
"road": 250,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.5,
"level": "1",
"base": "50",
"div": "50"
},
"stone": {
"chance": 0.5,
"level": "1",
"base": "100",
"div": "100"
},
"laen": {
"chance": 0.075,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"hell": {
"flags": [ "walk" ]
},
"hall1": {
"flags": [ "land", "walk", "sail" ]
},
"corridor1": {
"flags": [ "land", "walk", "sail" ]
},
"wall1": {
"flags": [ "forbidden", "land" ]
},
"default": {
"size": 0,
"herbs": [],
"seed": 0,
"road": 0,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {}
}
}
}

View File

@ -1,5 +1,98 @@
{
"include": [
"keywords.json"
]
"keywords.json",
"prefixes.json",
"e3/terrains.json"
],
"disabled": [
"herbalism",
"alchemy",
"entertainment",
"espionage",
"perception",
"stealth",
"taxation",
"trade",
"besiege",
"steal",
"buy",
"teach",
"sabotage",
"spy",
"tax",
"entertain",
"sell",
"jsreport"
],
"settings": {
"game.id": 3,
"game.name": "E3",
"database.gameid": 7,
"NewbieImmunity": 4,
"modules.astralspace": false,
"modules.wormholes": false,
"modules.markets": true,
"magic.regeneration": 0.75,
"magic.power": 0.5,
"resource.factor": 0.25,
"skills.cost.tactics": 500,
"entertain.base": 0,
"entertain.perlevel": 20,
"nmr.timeout": 5,
"nmr.removenewbie": 0,
"GiveRestriction": 3,
"hunger.long": false,
"hunger.demon.skill": true,
"hunger.damage": "1d9+9",
"hunger.demons": true,
"init_spells": 0,
"recruit.allow_merge": true,
"study.expensivemigrants": true,
"study.speedup": 2,
"world.era": 3,
"seed.population.min": 8,
"seed.population.max": 8,
"rules.migrants.max": 0,
"rules.reserve.twophase": true,
"rules.owners.force_leave": false,
"rules.monsters.attack_chance": 0.1,
"rules.transfermen": false,
"rules.stealth.faction": true,
"rules.stealth.anon_battle": false,
"rules.check_overload": false,
"rules.combat.goblinbonus": 3,
"rules.ship.damage_drift": 0.00,
"rules.alliances": true,
"rules.combat.herospeed": 3,
"rules.combat.demon_vampire": 5,
"rules.combat.skill_bonus": 0,
"rules.combat.nat_armor": 1,
"rules.items.loot_divisor": 2,
"rules.items.give_divisor": 2,
"rules.move.owner_leave": true,
"rules.region_owners": true,
"rules.cavalry.skill": 2,
"rules.cavalry.mode": 1,
"rules.magic.multipotion": 1,
"rules.magic.wol_effect": 5,
"rules.magic.factionlist": 1,
"rules.magic.wol_type": 2,
"rules.blessed_harvest.flags": 1,
"rules.magic.elfpower": true,
"rules.magic.playerschools": "gwyrrd illaun draig cerddor",
"rules.build.other_buildings": true,
"rules.economy.taxation": 1,
"rules.food.flags": 2,
"rules.economy.roqf": 5,
"rules.economy.herbrot": 0,
"rules.region_owner_pay_building": "market harbour lighthouse",
"rules.dwarf_castles": true,
"rules.limit.faction": 250,
"rules.grow.formula": 1,
"rules.tactics.formula": 1,
"rules.help.mask": "fight guard money give",
"movement.shipspeed.skillbonus": 6,
"alliance.auto": "fight",
"alliance.restricted": "fight"
}
}

View File

@ -6,7 +6,6 @@
<xi:include href="config://core/common/items.xml"/>
<xi:include href="config://core/common/herbs.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
@ -14,7 +13,6 @@
<xi:include href="config://game/ships.xml"/>
<xi:include href="config://game/shipnames.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://core/calendar.xml"/>
<xi:include href="config://game/items.xml" />
<xi:include href="config://game/strings.xml"/>
@ -32,7 +30,6 @@
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
@ -44,129 +41,6 @@
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="E3">
<!-- Game specific settings -->
<param name="database.gameid" value="7"></param>
<order name="besiege" disable="yes"/>
<order name="steal" disable="yes"/>
<order name="buy" disable="yes"/>
<order name="teach" disable="yes"/>
<order name="sabotage" disable="yes"/>
<order name="spy" disable="yes"/>
<order name="tax" disable="yes"/>
<order name="entertain" disable="yes"/>
<order name="sell" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>
<skill name="espionage" enable="false"/>
<skill name="perception" enable="false"/>
<skill name="stealth" enable="false"/>
<skill name="taxation" enable="false"/>
<skill name="trade" enable="false"/>
<param name="NewbieImmunity" value="4"/>-
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1"/>
<!-- resource limitations -->
<param name="magic.regeneration" value="0.75"/>
<param name="magic.power" value="0.5"/>
<param name="resource.factor" value="0.25"/>
<param name="skills.cost.tactics" value="500"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="0"/>
<param name="hunger.demon.skill" value="1"/>
<param name="hunger.damage" value="1d9+9"/>
<param name="hunger.demons" value="1"/>
<param name="init_spells" value="0"/>
<param name="recruit.allow_merge" value="1"/>
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="2"/>
<param name="world.era" value="3"/>
<param name="seed.population.min" value="8"/>
<param name="seed.population.max" value="8"/>
<param name="rules.migrants" value="0"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="1"/>
<param name="rules.monsters.attack_chance" value="0.0"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/>
<param name="rules.combat.nat_armor" value="1"/>
<!--param name="rules.combat.loot" value="5"/--> <!-- only self + others - keeploot -->
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
<param name="rules.region_owners" value="1"/>
<param name="rules.cavalry.skill" value="2"/>
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.blessed_harvest" value="1"/>
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
<param name="rules.build.other_buildings" value="1"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.economy.food" value="2"/>
<param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/>
<param name="rules.region_owner_pay_building" value="market harbour lighthouse"/>
<param name="rules.dwarf_castles" value="1"/>
<!-- param name="rules.nmr.destroy" value="1"/ -->
<param name="rules.limit.faction" value="250"/>
<!--param name="rules.give" value="15"/ --> <!-- self + peasants + herbs + lux - goods -->
<param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money give"/>
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
<param name="game.id" value="3"/>
<param name="game.name" value="E3"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>
</rules>

235
conf/e3/terrains.json Normal file
View File

@ -0,0 +1,235 @@
{
"terrains": {
"ocean": {
"size": 100,
"flags": [ "sea", "swim", "sail", "fly" ]
},
"plain": {
"size": 4000,
"herbs": [ "h0", "h4" ],
"seed": 3,
"road": 50,
"flags": [ "forest", "cavalry", "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.1,
"level": "2d4-1",
"base": "5d8",
"div": "2d20+10"
},
"stone": {
"chance": 0.15,
"level": "1d4",
"base": "5d8",
"div": "2d30+20"
},
"laen": {
"chance": 0.01,
"level": "1d4",
"base": "1d4",
"div": "2d20+50"
}
}
},
"swamp": {
"size": 1200,
"herbs": [ "h6", "h8" ],
"seed": 2,
"road": 75,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.02,
"level": "2d4-1",
"base": "5d8",
"div": "2d20+10"
},
"stone": {
"chance": 0.02,
"level": "1d4",
"base": "5d8",
"div": "2d30+20"
},
"laen": {
"chance": 0.02,
"level": "1d4",
"base": "1d4",
"div": "2d20+50"
}
}
},
"desert": {
"size": 400,
"seed": 2,
"road": 75,
"flags": [ "cavalry", "land", "walk", "sail", "fly" ],
"herbs": [ "h9", "h11" ],
"production": {
"iron": {
"chance": 0.15,
"level": "2d4-1",
"base": "5d8",
"div": "2d20+10"
},
"stone": {
"chance": 0.25,
"level": "1d4",
"base": "5d8",
"div": "2d30+20"
},
"laen": {
"chance": 0.025,
"level": "1d4",
"base": "1d4",
"div": "2d20+50"
}
}
},
"highland": {
"size": 2300,
"seed": 2,
"road": 100,
"flags": [ "cavalry", "land", "walk", "sail", "fly" ],
"herbs": [ "h12", "h14" ],
"production": {
"iron": {
"chance": 0.15,
"level": "2d4-1",
"base": "5d8",
"div": "2d20+10"
},
"stone": {
"chance": 0.25,
"level": "1d4",
"base": "5d8",
"div": "2d30+20"
},
"laen": {
"chance": 0.025,
"level": "1d4",
"base": "1d4",
"div": "2d20+50"
}
}
},
"mountain": {
"size": 600,
"seed": 2,
"road": 250,
"flags": [ "land", "walk", "sail", "fly" ],
"herbs": [ "h15", "h17" ],
"production": {
"iron": {
"chance": 1.0,
"level": "1",
"base": "50",
"div": "50"
},
"stone": {
"chance": 1.0,
"level": "1",
"base": "100",
"div": "100"
},
"laen": {
"chance": 0.05,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"glacier": {
"size": 150,
"seed": 2,
"road": 250,
"flags": [ "arctic", "land", "walk", "sail", "fly" ],
"herbs": [ "h18", "h20" ],
"production": {
"iron": {
"chance": 1.0,
"level": "1",
"base": "3",
"div": "50"
},
"stone": {
"chance": 1.0,
"level": "1",
"base": "2",
"div": "100"
},
"laen": {
"chance": 0.05,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"packice": {
"flags": [ "arctic", "swim", "walk", "sail", "fly" ]
},
"firewall": {
"flags": [ "forbidden" ]
},
"volcano": {
"size": 400,
"seed": 1,
"road": 250,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.5,
"level": "1",
"base": "50",
"div": "50"
},
"stone": {
"chance": 0.5,
"level": "1",
"base": "100",
"div": "100"
},
"laen": {
"chance": 0.075,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"activevolcano": {
"size": 400,
"road": 250,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {
"iron": {
"chance": 0.5,
"level": "1",
"base": "50",
"div": "50"
},
"stone": {
"chance": 0.5,
"level": "1",
"base": "100",
"div": "100"
},
"laen": {
"chance": 0.075,
"level": "1",
"base": "4",
"div": "100"
}
}
},
"default": {
"size": 0,
"herbs": [],
"seed": 0,
"road": 0,
"flags": [ "land", "walk", "sail", "fly" ],
"production": {}
}
}
}

View File

@ -1,5 +1,96 @@
{
"include": [
"keywords.json"
]
"keywords.json",
"prefixes.json",
"e3/terrains.json"
],
"disabled": [
"herbalism",
"alchemy",
"entertainment",
"espionage",
"perception",
"stealth",
"taxation",
"trade",
"besiege",
"steal",
"buy",
"teach",
"sabotage",
"spy",
"tax",
"entertain",
"sell",
"jsreport"
],
"settings": {
"game.id": 4,
"game.name": "Deveron",
"database.gameid": 7,
"NewbieImmunity": 4,
"modules.astralspace": false,
"modules.wormholes": false,
"modules.markets": true,
"magic.regeneration": 0.75,
"magic.power": 0.5,
"resource.factor": 0.25,
"skills.cost.tactics": 500,
"entertain.base": 0,
"entertain.perlevel": 20,
"nmr.timeout": 5,
"nmr.removenewbie": 0,
"GiveRestriction": 3,
"hunger.long": false,
"hunger.demon.skill": true,
"hunger.damage": "1d9+9",
"hunger.demons": true,
"init_spells": 0,
"recruit.allow_merge": true,
"study.expensivemigrants": true,
"study.speedup": 2,
"study.from_use": 0.4,
"world.era": 3,
"rules.migrants.max": 0,
"rules.reserve.twophase": true,
"rules.owners.force_leave": false,
"rules.transfermen": false,
"rules.stealth.faction": true,
"rules.stealth.anon_battle": false,
"rules.check_overload": false,
"rules.combat.goblinbonus": 3,
"rules.ship.damage_drift": 0.00,
"rules.alliances": true,
"rules.combat.herospeed": 3,
"rules.combat.demon_vampire": 5,
"rules.combat.skill_bonus": 0,
"rules.combat.nat_armor": true,
"rules.items.loot_divisor": 2,
"rules.items.give_divisor": 2,
"rules.move.owner_leave": true,
"rules.region_owners": true,
"rules.cavalry.skill": 2,
"rules.cavalry.mode": 1,
"rules.magic.multipotion": true,
"rules.magic.wol_effect": 5,
"rules.magic.factionlist": true,
"rules.magic.wol_type": 2,
"rules.blessed_harvest.flags": 1,
"rules.magic.elfpower": true,
"rules.magic.playerschools": "gwyrrd illaun draig cerddor",
"rules.build.other_buildings": 1,
"rules.economy.taxation": 1,
"rules.food.flags": 2,
"rules.economy.roqf": 5,
"rules.economy.herbrot": 0,
"rules.region_owner_pay_building": "market harbour lighthouse",
"rules.dwarf_castles": true,
"rules.limit.faction": 250,
"rules.grow.formula": 1,
"rules.tactics.formula": 1,
"rules.help.mask": "fight guard money give",
"movement.shipspeed.skillbonus": 6,
"alliance.auto": "fight",
"alliance.restricted": "fight"
}
}

View File

@ -6,7 +6,6 @@
<xi:include href="config://core/common/items.xml"/>
<xi:include href="config://core/common/herbs.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
@ -14,7 +13,6 @@
<xi:include href="config://game/ships.xml"/>
<xi:include href="config://game/shipnames.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://core/calendar.xml"/>
<xi:include href="config://game/items.xml" />
<xi:include href="config://game/strings.xml"/>
@ -32,7 +30,6 @@
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
<item name="log" amount="10"/>
<item name="stone" amount="10"/>
<item name="money" amount="5000"/>
@ -45,125 +42,6 @@
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="Deveron">
<!-- Game specific settings -->
<param name="database.gameid" value="7"></param>
<order name="besiege" disable="yes"/>
<order name="steal" disable="yes"/>
<order name="buy" disable="yes"/>
<order name="teach" disable="yes"/>
<order name="sabotage" disable="yes"/>
<order name="spy" disable="yes"/>
<order name="tax" disable="yes"/>
<order name="entertain" disable="yes"/>
<order name="sell" disable="yes"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>
<skill name="espionage" enable="false"/>
<skill name="perception" enable="false"/>
<skill name="stealth" enable="false"/>
<skill name="taxation" enable="false"/>
<skill name="trade" enable="false"/>
<param name="NewbieImmunity" value="4"/>
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="1"/>
<!-- resource limitations -->
<param name="magic.regeneration" value="0.75"/>
<param name="magic.power" value="0.5"/>
<param name="resource.factor" value="0.25"/>
<param name="skills.cost.tactics" value="500"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="5"/>
<param name="nmr.removenewbie" value="0"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="0"/>
<param name="hunger.demon.skill" value="1"/>
<param name="hunger.damage" value="1d9+9"/>
<param name="hunger.demons" value="1"/>
<param name="init_spells" value="0"/>
<param name="recruit.allow_merge" value="1"/>
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="2"/>
<param name="world.era" value="3"/>
<param name="rules.migrants" value="0"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="1"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>
<param name="rules.check_overload" value="0"/>
<param name="rules.combat.goblinbonus" value="3"/>
<param name="rules.ship.damage_drift" value="0.00"/> <!-- percent damage from drifting-->
<param name="rules.alliances" value="1"/>
<param name="rules.combat.herospeed" value="3"/>
<param name="rules.combat.demon_vampire" value="5"/> <!-- regen 1 hp per X points of damage done -->
<param name="rules.combat.skill_bonus" value="0"/>
<param name="rules.combat.nat_armor" value="1"/>
<!--param name="rules.combat.loot" value="5"/--> <!-- only self + others - keeploot -->
<param name="rules.items.loot_divisor" value="2"/> <!-- damage skims off 1/2 of goods transfers -->
<param name="rules.items.give_divisor" value="2"/> <!-- corruption skims off 1/2 of goods transfers -->
<param name="rules.move.owner_leave" value="1"/> <!-- owner must leave before moving -->
<param name="rules.region_owners" value="1"/>
<param name="rules.cavalry.skill" value="2"/>
<param name="rules.cavalry.mode" value="1"/>
<param name="rules.magic.multipotion" value="1"/>
<param name="rules.magic.wol_effect" value="5"/>
<param name="rules.magic.factionlist" value="1"/>
<param name="rules.magic.wol_type" value="2"/>
<param name="rules.magic.blessed_harvest" value="1"/>
<param name="rules.magic.elfpower" value="1"/> <!-- elves get ring-of-power bonus in a forest -->
<param name="rules.magic.playerschools" value="gwyrrd illaun draig cerddor"/>
<param name="rules.build.other_buildings" value="1"/>
<param name="rules.economy.taxation" value="1"/>
<param name="rules.economy.food" value="2"/>
<param name="rules.economy.wages" value="1"/>
<param name="rules.economy.roqf" value="5"/>
<param name="rules.economy.herbrot" value="0"/>
<param name="rules.region_owner_pay_building" value="market harbour lighthouse"/>
<param name="rules.dwarf_castles" value="1"/>
<!-- param name="rules.nmr.destroy" value="1"/ -->
<param name="rules.limit.faction" value="250"/>
<!--param name="rules.give" value="15"/ --> <!-- self + peasants + herbs + lux - goods -->
<param name="rules.economy.grow" value="1"/>
<param name="rules.tactics.formula" value="1"/> <!-- 10% per skilldiff -->
<param name="rules.help.mask" value="fight guard money give"/>
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
<param name="game.id" value="4"/>
<param name="game.name" value="Deveron"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>
</rules>

33
conf/prefixes.json Normal file
View File

@ -0,0 +1,33 @@
{
"prefixes": [
"Dunkel",
"Licht",
"Klein",
"Hoch",
"Huegel",
"Berg",
"Wald",
"Sumpf",
"Schnee",
"Sonnen",
"Mond",
"See",
"Tal",
"Schatten",
"Hoehlen",
"Blut",
"Wild",
"Chaos",
"Nacht",
"Nebel",
"Grau",
"Frost",
"Finster",
"Duester",
"flame",
"ice",
"star",
"black",
"arch"
]
}

@ -1 +1 @@
Subproject commit b38f6f8acdc2ce5b0613a4bb2ff8082051a25ac3
Subproject commit e538739b38593b90312831a5e52d2e3bd731069b

2
cutest

@ -1 +1 @@
Subproject commit 788659594ef87e9f497b8039da764182adfd2943
Subproject commit 6e268687dbf6ae55afb63210c3753530d216a622

@ -1 +1 @@
Subproject commit 4292cd5e81395d09a7457ab93659ea3b7784e958
Subproject commit f1446c47ca1774ae84bf86a28502e91daf6b421a

@ -1 +1 @@
Subproject commit f84066fb7d3254bdd9e89694acc4c1c20d001eed
Subproject commit ecf956b9808c28c2db52e6b73930f57876dbb258

View File

@ -2,8 +2,8 @@
from sys import argv, exit
from string import join
from os import access, R_OK
from os import system
import os
import os.path
gamename='Eressea'
@ -38,35 +38,33 @@ for line in infile.readlines():
if not options.has_key("reports"):
continue
reports = options["reports"].split(",")
# reports = reports + [ "iso.cr" ]
prefix = "%(turn)s-%(faction)s." % options
files=[]
times="../parteien"
if os.path.isfile(times):
files = files + [ times ]
if options["compression"]=="zip":
output = prefix+"zip"
files = [output]
if (access(output, R_OK)):
pass
else:
if not os.path.isfile(output):
parameters = []
for extension in reports:
filename = "%s%s" % (prefix, extension)
if (access(filename, R_OK)):
if os.path.isfile(filename):
parameters = parameters + [ filename ]
system("zip %s -q -m -j -1 %s" % (output, join(parameters," ")))
os.system("zip %s -q -m -j %s" % (output, join(parameters," ")))
else:
files = []
for extension in reports:
if extension!='':
filename = "%s%s" % (prefix, extension)
output = "%s%s.bz2" % (prefix, extension)
files = files+[output]
if access(filename, R_OK):
if (access(output, R_OK)):
#print output, "exists, skipping"
if os.path.isfile(filename):
if os.path.isfile(output):
continue
system("bzip2 %s" % filename)
#print files
os.system("bzip2 %s" % filename)
extras = [ '../wochenbericht.txt', '../express.txt' ]
for extra in extras:
if os.path.isfile(extra):
files = files + [extra]
options["files"] = join(files, " ")
batch = file("%s.sh" % options["faction"], "w")
batch.write(template % options)

24
process/compress.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
if [ -z $ERESSEA ]; then
echo "You need to define the \$ERESSEA environment variable to run $0"
exit -2
fi
GAME=$ERESSEA/game-$1
GAME_NAME=$(grep name $GAME/eressea.ini | sed 's/.*=\s*//')
TURN=$2
if [ -z $TURN ]
then
TURN=`cat $GAME/turn`
fi
if [ ! -d $GAME/reports ]; then
echo "cannot find reports directory in $GAME"
exit -1
fi
cd $GAME/reports
$HOME/bin/compress.py $TURN "$GAME_NAME"
cd -

View File

@ -2,7 +2,6 @@
PATH=/home/eressea/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin
ERESSEA=/home/eressea/eressea
ATLANTIS=/home/eressea/atlantis
ENABLED=yes
PREVIEW=yes
CONFIRM=yes
@ -14,5 +13,5 @@ CONFIRM=yes
15 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 3
25 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 4
35 21 * * Sat [ "$ENABLED" = "yes" ] && $ERESSEA/server/bin/run-eressea.cron 2
39 08 * * Sun [ "$PREVIEW" = "yes" ] && $ERESSEA/server/bin/preview.cron
30 07 * * Sun [ "$PREVIEW" = "yes" ] && $ERESSEA/server/bin/preview.cron
*/5 * * * * [ "$CONFIRM" = "yes" ] && $ERESSEA/server/bin/orders.cron 2 3 4

View File

@ -40,6 +40,5 @@ fi
echo "sending reports for game $GAME, turn $TURN"
$BIN/compress.sh $GAME $TURN
$BIN/sendreports.sh $GAME
[ $GAME -lt 4 ] && $BIN/send-summary $GAME
$BIN/backup-eressea $GAME $TURN
rm -f test/execute.lock

10
process/functions.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
PATH=$ERESSEA/bin:$PATH
function abort() {
if [ $# -gt 0 ]; then
echo $@
fi
exit -1
}

1
process/received-mail.sh Normal file
View File

@ -0,0 +1 @@
ls -1 orders.dir/turn* | sed -e 's/.*turn-\(.*\),gruenbaer.*/\1/' | sort -u

1
process/received.sh Normal file
View File

@ -0,0 +1 @@
grep -hiw ERESSEA orders.dir/turn-* | cut -d\ -f2 | sort -u

View File

@ -9,6 +9,6 @@ fi
cd $ERESSEA/game-$GAME
echo "running turn $TURN, game $GAME"
$ERESSEA/server/bin/eressea -v1 -t $TURN run-turn.lua
$ERESSEA/server/bin/eressea -v3 -t $TURN run-turn.lua
mkdir -p log
ln -f eressea.log log/eressea.log.$TURN

22
process/run-turn.sh Executable file
View File

@ -0,0 +1,22 @@
GAME=$1
TURN=$2
if [ ! -d $ERESSEA/game-$GAME ] ; then
echo "No such game: $GAME"
exit 1
fi
cd $ERESSEA/game-$GAME
if [ -z $TURN ]; then
TURN=$(cat turn)
fi
echo "running turn $TURN, game $GAME"
if [ -d orders.dir.$TURN ]; then
echo "orders.dir.$TURN already exists"
else
mv orders.dir orders.dir.$TURN
mkdir -p orders.dir
fi
ls -1rt orders.dir.$TURN/turn-* | xargs cat > orders.$TURN
$ERESSEA/bin/eressea -t $TURN run-turn.lua

View File

@ -1,6 +1,10 @@
#!/bin/bash
if [ -z $ERESSEA ]; then
echo "You have to define the \$ERESSEA environment variable to run $0"
ERESSEA=`echo $PWD |sed -e 's/\/game.*//'`
echo "Assuming that ERESSEA=$ERESSEA"
fi
if [ ! -f reports.txt ]; then
echo "need to run $0 from the report direcory"
exit -2
fi
source $HOME/bin/functions.sh
@ -19,17 +23,8 @@ then
shift
fi
EMAIL=$1
SUBJECT=$2
addr=$1
subj=$2
shift 2
ATTACHMENTS=""
while [ $# -gt 0 ]
do
if [ -e "$1" ]; then
ATTACHMENTS="-a $1 $ATTACHMENTS"
fi
shift
done
cat $ERESSEA/etc/$TEMPLATE | mutt -F $ERESSEA/etc/muttrc -s "$SUBJECT" $ATTACHMENTS -- $EMAIL
cat $ERESSEA/etc/$TEMPLATE | mutt -F $ERESSEA/etc/muttrc -s "$subj" -a $* -- $addr

View File

@ -39,7 +39,10 @@ while [ -e /tmp/.stopped ] ; do
echo "waiting 2 minutes for lockfile in /tmp/.stopped to clear"
sleep 120
done
mutt -F $ERESSEA/etc/muttrc -s "$2" -a "$3" -- $1 < $TEMPLATE
addr=$1
subject=$2
shift 2
mutt -F $ERESSEA/etc/muttrc -s "$subject" -a $* -- $addr < $TEMPLATE
if [ $? -ne 0 ] ; then
echo "Sending failed for email/report: $2/$3"

33
process/sendreports.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
##
## Prepare the report
if [ -z $ERESSEA ]; then
echo "You have to define the \$ERESSEA environment variable to run $0"
exit -2
fi
source $HOME/bin/functions.sh
source $ERESSEA/etc/eressea.conf
if [ ! -z $1 ]; then
GAME=$ERESSEA/game-$1
else
GAME=$ERESSEA
fi
cd $GAME/reports || abort "could not chdir to reports directory"
for REPORT in *.sh
do
echo -n "Sending "
basename $REPORT .sh
bash $REPORT
done
cd -
if [ -e $GAME/ages.sh ]; then
cd $GAME
./ages.sh
cd -
fi

@ -1 +1 @@
Subproject commit 40ae383100a8f012393ab29bc3d98e182fe57c19
Subproject commit 45f4577b8205d87b78d2b1f30b5c9baa25c86779

View File

@ -2212,12 +2212,6 @@
<text locale="de">Schaden</text>
</string>
<!--report newbie info -->
<string name="nr_nmr">
<text locale="de">Deine Partei hat letzte Runde keinen Zug
abgegeben!</text>
</string>
<namespace name="race">
<string name="snowman">
<text locale="de">Schneemann</text>
@ -3604,11 +3598,11 @@
</string>
<string name="p2">
<text locale="en">The "Water of Life" allows living trees to be created from logs. A Knotroot and Elvendear are heated until one can just still keep one's finger in. This is then poured into a jar and allowed to cool slowly. The extract is sufficient for 10 pieces of wood.</text>
<text locale="de">Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so daß man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme.</text>
<text locale="de">Das 'Wasser des Lebens' ist in der Lage, aus gefällten Baumstämmen wieder lebende Bäume zu machen. Dazu wird ein knotiger Saugwurz zusammen mit einem Elfenlieb erwärmt, so dass man gerade noch den Finger reinhalten kann. Dies gieße man in ein Gefäß und lasse es langsam abkühlen. Der Extrakt reicht für 10 Holzstämme.</text>
</string>
<string name="p3">
<text locale="en">Allow a Tangy Temerity to simmer for three hours in a litre of water, then add a grated Mandrake, and sprinkle in a Gapgrowth harvested at full moon. The whole brew should then be allowed to stew for three days in a warm place. This potion increases the strength and endurance of ten men so that they can achieve twice as much in a week.</text>
<text locale="de">Man lasse einen Würzigen Wagemut drei Stunden lang in einem Liter Wasser köcheln. Dann gebe man eine geriebene Alraune dazu und bestreue das ganze mit bei Vollmond geerntetem Spaltwachs. Nun lasse man den Sud drei Tage an einem dunklen und warmen Ort ziehen und seie dann die Flüssigkeit ab. Dieser Schaffenstrunk erhöht die Kraft und Ausdauer von zehn Männern, so daß sie doppelt soviel schaffen können wie sonst.</text>
<text locale="de">Man lasse einen Würzigen Wagemut drei Stunden lang in einem Liter Wasser köcheln. Dann gebe man eine geriebene Alraune dazu und bestreue das ganze mit bei Vollmond geerntetem Spaltwachs. Nun lasse man den Sud drei Tage an einem dunklen und warmen Ort ziehen und seie dann die Flüssigkeit ab. Dieser Schaffenstrunk erhöht die Kraft und Ausdauer von zehn Männern, so dass sie doppelt soviel schaffen können wie sonst.</text>
</string>
<string name="ointment">
<text locale="en">When one is severely wounded after a hard battle it is advisable to have some Ointment to hand. Applied to wounds, this magical paste closes them in the blink of an eye. For the preparation the alchemist requires a cobalt fungus, tangy temerity, and white hemlock. A dose of the potion heals up to 400 hitpoints.</text>
@ -3632,7 +3626,7 @@
</string>
<string name="p9">
<text locale="en">To make a horsepower potion, chop a peyote, a cobalt fungus and some knotroot, and boil it in a bucketful of water. Then add some sand reeker and let the mixture steep for three days. Finally one gives this to the horses to drink, to double their procreation.</text>
<text locale="de">Für das Pferdeglück zerhacke man einen Kakteenschwitz, einen blauen Baumringel und etwas knotigen Saugwurz und koche das ganze mit einem Eimer Wasser auf. Dann füge man etwas Sandfäule dazu und lasse diesen Sud drei Tage lang ziehen. Letztlich gebe man es den Pferden zu trinken, auf daß sie sich doppelt so schnell vermehren.</text>
<text locale="de">Für das Pferdeglück zerhacke man einen Kakteenschwitz, einen blauen Baumringel und etwas knotigen Saugwurz und koche das ganze mit einem Eimer Wasser auf. Dann füge man etwas Sandfäule dazu und lasse diesen Sud drei Tage lang ziehen. Letztlich gebe man es den Pferden zu trinken, auf dass sie sich doppelt so schnell vermehren.</text>
</string>
<string name="p10">
<text locale="en">The use of the berserkers blood potion is advised to increase one's warriors abilities to new heights. To create this, one needs a white hemlock, some flatroot, sand reeker and a mandrake. All ingredients have to be sliced as finely as possible, after which it is boiled for two hours. The cooled brew is strained through a cloth. The resulting juice is enough to improve up to ten warriors.</text>
@ -3644,7 +3638,7 @@
</string>
<string name="truthpotion">
<text locale="en">This simple but very potent brew sharpens the senses of anyone that drinks of it and makes him able to see through even the most complex illusions for one week.</text>
<text locale="de">Dieses wirkungsvolle einfache Gebräu schärft die Sinne des Trinkenden derart, daß er in der Lage ist, eine Woche lang auch die komplexesten Illusionen zu durchschauen.</text>
<text locale="de">Dieses wirkungsvolle einfache Gebräu schärft die Sinne des Trinkenden derart, dass er in der Lage ist, eine Woche lang auch die komplexesten Illusionen zu durchschauen.</text>
</string>
<string name="p13">
<text locale="en">One of the most rare and prized of all alchemist elixers, this potion grants the user a dragon's power for a few weeks. The potion increases the life-energy of a maximum of ten people fivefold. The effect is strongest right after drinking and slowly decreases over time. To brew this potion the alchemist needs an elvendear, a windbag, a piece of waterfinder and a spider ivy. Finally he dusts it with some minced bubblemorel and stirrs the powder into some dragon's blood. </text>
@ -3928,7 +3922,7 @@
<text locale="de">Gesang des Lebens analysieren</text>
<text locale="en">Analyze Song of Life</text>
</string>
<string name="cerrdorfumbleshield">
<string name="cerddorfumbleshield">
<text locale="de">Bannlied</text>
<text locale="en">Countersong</text>
</string>
@ -4330,7 +4324,7 @@
<text locale="de">Kraft der Natur</text>
<text locale="en">force of nature</text>
</string>
<string name="wdwpyramid_cerrdor">
<string name="wdwpyramid_cerddor">
<text locale="de">Gesang der Götter</text>
<text locale="en">Song of the Gods</text>
</string>
@ -4908,7 +4902,7 @@
<string name="shockwave">
<text locale="de">Dieser Zauber läßt eine Welle aus purer Kraft über die
gegnerischen Reihen hinwegfegen. Viele Kämpfer wird der Schock so
benommen machen, daß sie für einen kurzen Moment nicht angreifen
benommen machen, dass sie für einen kurzen Moment nicht angreifen
können.</text>
<text locale="en">A wave of pure force spreads out from the magician,
crashing into the enemy ranks. Many warriors are thrown off balance and
@ -5132,7 +5126,7 @@
able to decipher all enchantments or spells, which
aren't disguised beyond your capability.</text>
</string>
<string name="cerrdorfumbleshield">
<string name="cerddorfumbleshield">
<text locale="de">Dieser schrille Gesang hallt über das
ganze Schlachtfeld. Die besonderen Dissonanzen in den
Melodien machen es Magiern fast unmöglich, sich auf ihre
@ -5860,11 +5854,10 @@
das 50fache und auch im Kampf werden sich die
erhöhte Kraft und die trollisch zähe Haut
positiv auswirken.</text>
<text locale="en">This artifact gives the one wearing it
<text locale="en">This artifact gives the wearer
the strength of a cavetroll. He will be able to
carry fifty times as much as normal and also in
combat his enhanced strength and tough troll
skin will serve him well.</text>
carry fifty times his normal load, as well as
gain strength and tough troll skin in combat.</text>
</string>
<string name="auraleak">
<text locale="de">Der Schwarzmagier kann mit diesem
@ -6840,6 +6833,11 @@
<text locale="en">black </text>
</string>
<string name="arch">
<text locale="de">Erz</text>
<text locale="en">arch</text>
</string>
<string name="star">
<text locale="de">Sternen</text>
<text locale="en">star </text>
@ -6954,14 +6952,9 @@
<text locale="en">is helping</text>
</string>
<string name="has_moved_one">
<text locale="de">hat die Region durchquert.</text>
<text locale="en">passed through the region.</text>
</string>
<string name="has_moved_many">
<text locale="de">haben die Region durchquert.</text>
<text locale="en">passed through the region.</text>
<string name="travelthru_header">
<text locale="de">Die Region wurde durchquert von </text>
<text locale="en">The region was crossed by </text>
</string>
<string name="see_travel">

View File

@ -1660,10 +1660,6 @@
</string>
</namespace>
<string name="nr_nmr">
<text locale="en">No orders were received for your faction!</text>
</string>
<!-- resources -->
<string name="mistletoe">
<text locale="de">Mistelzweig</text>

View File

@ -2051,7 +2051,4 @@
<text locale="fr">côte ouest</text>
</string>
</namespace>
<string name="nr_nmr">
<text locale="fr">Aucun ordre reçu pour votre faction !</text>
</string>
</strings>

View File

@ -390,8 +390,17 @@
<text locale="de">"Die Ausrüstung von $unit($unit) scheint unsichtbar. ($int36($id))"</text>
<text locale="en">"$unit($unit)'s equipment is invisible. ($int36($id))"</text>
</message>
<message name="curseinfo::magicresistance" section="events">
<message name="curseinfo::magicresistance_unit" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
<text locale="en">"The magical resistance has been strengthened. ($int36($id))"</text>
</message>
<message name="curseinfo::magicresistance_building" section="events">
<type>
<arg name="building" type="building"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
@ -413,6 +422,7 @@
</message>
<message name="curseinfo::magicwalls" section="events">
<type>
<arg name="building" type="building"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"Diese Mauern wirken, als wären sie direkt aus der Erde gewachsen und nicht erbaut. ($int36($id))"</text>
@ -420,6 +430,7 @@
</message>
<message name="curseinfo::buildingunknown" section="events">
<type>
<arg name="building" type="building"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"Ein magischer Schimmer liegt auf diesen Mauern. ($int36($id))"</text>
@ -540,6 +551,7 @@
<message name="curseinfo::nocostbuilding" section="events">
<type>
<arg name="id" type="int"/>
<arg name="building" type="building"/>
</type>
<text locale="de">"Der Zahn der Zeit kann diesen Mauern nichts anhaben. ($int36($id))"</text>
<text locale="en">"Time cannot touch these walls. ($int36($id))"</text>
@ -829,11 +841,11 @@
</message>
<message name="nr_score" section="nr">
<type>
<arg name="score" type="int"/>
<arg name="average" type="int"/>
<arg name="score" type="string"/>
<arg name="average" type="string"/>
</type>
<text locale="de">"Deine Partei hat $int($score) Punkte. Der Durchschnitt für Parteien ähnlichen Alters ist $int($average) Punkte."</text>
<text locale="en">"Your faction has a score of $int($score). The average score for similar factions is $int($average)."</text>
<text locale="de">"Deine Partei hat ${score} Punkte. Der Durchschnitt für Parteien ähnlichen Alters ist ${average} Punkte."</text>
<text locale="en">"Your faction has a score of ${score}. The average score for similar factions is ${average}."</text>
</message>
<message name="nr_header_date" section="nr">
<type>
@ -1182,6 +1194,24 @@
<text locale="en">"$unit($unit) drowns in $region($region)."</text>
</message>
<message name="poison_damage" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
</type>
<text locale="de">"$unit($unit) nimmt Schaden durch den Giftelementar in $region($region)."</text>
<text locale="en">"$unit($unit) is taking poison damage in $region($region)."</text>
</message>
<message name="poison_death" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
</type>
<text locale="de">"$unit($unit) stirbt am Schaden durch den Giftelementar in $region($region)."</text>
<text locale="en">"$unit($unit) dies from poison damage taken in $region($region)."</text>
</message>
<message name="drown_amphibian_dead" section="events">
<type>
<arg name="amount" type="int"/>
@ -2800,17 +2830,6 @@
<text locale="de">"$unit($unit) in $region($region) produziert $int($amount)$if($eq($wanted,$amount),""," von $int($wanted)") $resource($resource,$wanted)."</text>
<text locale="en">"$unit($unit) in $region($region) produces $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") $resource($resource,$amount)."</text>
</message>
<message name="manufacture" section="production">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
<arg name="amount" type="int"/>
<arg name="wanted" type="int"/>
<arg name="resource" type="resource"/>
</type>
<text locale="de">"$unit($unit) in $region($region) produziert $int($amount)$if($eq($wanted,$amount),""," von $int($wanted)") $resource($resource,$wanted)."</text>
<text locale="en">"$unit($unit) in $region($region) produces $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") $resource($resource,$amount)."</text>
</message>
<message name="buildbuilding" section="production">
<type>
<arg name="unit" type="unit"/>
@ -7100,9 +7119,16 @@
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text>
</message>
<message name="turnreminder" section="errors">
<type>
</type>
<message name="nmr_warning" section="errors">
<type/>
<text locale="de">Deine Partei hat letzte Runde keinen Zug
abgegeben!</text>
<text locale="en">No orders were received for your faction!</text>
<text locale="fr">Aucun ordre reçu pour votre faction !</text>
</message>
<message name="nmr_warning_final" section="errors">
<type/>
<text locale="de">"Bitte sende die Befehle nächste Runde ein, wenn du weiterspielen möchtest."</text>
<text locale="en">"Please send in orders for the next turn if you want to continue playing."</text>
</message>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<resource name="cart" big="true">
<item capacity="14000" weight="4000" score="60" vehicle="yes">
<resource name="cart">
<item capacity="14000" weight="4000" score="60" vehicle="yes" big="yes">
<construction skill="cartmaking" minskill="1" reqsize="1">
<requirement type="log" quantity="5"/>
</construction>

View File

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<terrains>
<!-- defaults: walk="yes" sail="yes" fly="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" -->
<terrain name="ocean" size="100" walk="no" swim="yes" land="no" sea="yes" />
<terrain name="plain" size="10000" road="50" forest="yes" cavalry="yes" seed="3">
<herb name="h0" />
<herb name="h1" />
<herb name="h2" />
<herb name="h3" />
<herb name="h4" />
<herb name="h5" />
<resource name="iron" chance="0.1" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="swamp" size="2000" road="75" seed="2">
<herb name="h6" />
<herb name="h7" />
<herb name="h8" />
<resource name="iron" chance="0.02" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="desert" size="500" road="100" cavalry="yes" seed="2">
<herb name="h9" />
<herb name="h10" />
<herb name="h11" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="highland" size="4000" road="100" cavalry="yes" seed="2">
<herb name="h12" />
<herb name="h13" />
<herb name="h14" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="mountain" size="1000" road="250" seed="2">
<herb name="h15" />
<herb name="h16" />
<herb name="h17" />
<resource name="iron" chance="1.0" level="1" base="50" div="50" />
<resource name="stone" chance="1.0" level="1" base="100" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="glacier" size="100" road="250" arctic="yes" seed="2">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="1.0" level="1" base="3" div="50" />
<resource name="stone" chance="1.0" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg_sleep" size="100" road="250" arctic="yes">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg" size="100" arctic="yes">
<herb name="h18" />
<herb name="h19" />
<herb name="h20" />
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
</terrain>
<terrain name="firewall" size="100" road="250" land="no" walk="no" sail="no" fly="no" forbidden="yes" />
<terrain name="fog" sail="no" land="no" size="0" />
<terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" size="0" />
<terrain name="volcano" size="500" road="250" seed="1">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
<terrain name="activevolcano" size="500" road="250">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
</terrains>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<resource name="catapult">
<item weight="10000">
<item weight="10000" big="yes">
<construction skill="cartmaking" minskill="5" reqsize="1">
<requirement type="log" quantity="10"/>
</construction>

View File

@ -37,7 +37,7 @@
<entry spell="summon_familiar" level="9" />
<entry spell="draigfumbleshield" level="9" />
<entry spell="gwyrrdfumbleshield" level="5" />
<entry spell="cerrdorfumbleshield" level="5" />
<entry spell="cerddorfumbleshield" level="5" />
<entry spell="tybiedfumbleshield" level="2" />
<entry spell="concealing_aura" level="1" />
<entry spell="shockwave" level="5" />

View File

@ -22,7 +22,7 @@
<entry spell="calm_monster" level="6" />
<entry spell="calm_riot" level="14" />
<entry spell="cerddor_destroymagic" level="8" />
<entry spell="cerrdorfumbleshield" level="5" />
<entry spell="cerddorfumbleshield" level="5" />
<entry spell="chaosrow" level="8" />
<entry spell="clone" level="9" />
<entry spell="coldfront" level="8" />

View File

@ -619,7 +619,7 @@
<spell name="gwyrrdfumbleshield" rank="2" index="144" variable="true" combat="1">
<resource name="aura" amount="5" cost="level"/>
</spell>
<spell name="cerrdorfumbleshield" rank="2" index="145" variable="true" combat="1">
<spell name="cerddorfumbleshield" rank="2" index="145" variable="true" combat="1">
<resource name="aura" amount="5" cost="level"/>
</spell>
<spell name="tybiedfumbleshield" rank="2" index="146" variable="true" combat="1">

View File

@ -207,6 +207,17 @@
</namespace>
<namespace name="spellinfo">
<string name="concealing_aura">
<text locale="de">Dieser Zauber wird die gesamte Ausrüstung der
Zieleinheit für
einige Zeit vor den Blicken anderer verschleiern. Der
Zauber
schützt nicht vor Dieben und Spionen.</text>
<text locale="en">This spell will hide the whole equipment of a target
unit from the
looks of others. It will not protect against thieves or
spies.</text>
</string>
<string name="raindance">
<text locale="de">Durch dieses uralte Tanzritual ruft der Zauberkundige
die Kräfte des Lebens und der Fruchtbarkeit an. Die darauf folgenden

View File

@ -1,61 +0,0 @@
<?xml version="1.0" ?>
<terrains>
<!-- defaults: build="yes" walk="yes" sail="yes" fly="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" size="0" -->
<terrain name="ocean" size="100" walk="no" swim="yes" land="no" sea="yes" />
<terrain name="plain" size="4000" road="50" forest="yes" cavalry="yes" seed="3">
<herb name="h0" />
<herb name="h4" />
<resource name="iron" chance="0.1" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="swamp" size="1200" road="75" seed="2">
<herb name="h6" />
<herb name="h8" />
<resource name="iron" chance="0.02" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="desert" size="400" road="100" cavalry="yes" seed="2">
<herb name="h9" />
<herb name="h11" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="highland" size="2300" road="100" cavalry="yes" seed="2">
<herb name="h12" />
<herb name="h14" />
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="mountain" size="600" road="250" seed="2">
<herb name="h15" />
<herb name="h17" />
<resource name="iron" chance="1.0" level="1" base="50" div="50" />
<resource name="stone" chance="1.0" level="1" base="100" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="glacier" size="150" road="250" arctic="yes" seed="2">
<herb name="h18" />
<herb name="h20" />
<resource name="iron" chance="1.0" level="1" base="3" div="50" />
<resource name="stone" chance="1.0" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="packice" land="no" arctic="yes" swim="yes"/>
<terrain name="firewall" road="250" land="no" walk="no" sail="no" fly="no" forbidden="yes" />
<terrain name="fog" sail="no" land="no" />
<terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" />
<terrain name="volcano" size="400" road="250" seed="1">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
<terrain name="activevolcano" size="400" road="250">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
</terrains>

View File

@ -430,7 +430,7 @@
<attack type="1" damage="1d4"/>
<attack type="2" damage="2d20"/>
</race>
<race name="songdragon" magres="0.990000" maxaura="1.000000" regaura="1.000000" recruitcost="50" weight="1000" capacity="600" speed="1.500000" hp="40" ac="1" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" fly="yes" walk="yes" teach="no" getitem="yes">
<race name="songdragon" magres="0.990000" maxaura="1.000000" regaura="1.000000" recruitcost="50" weight="1000" capacity="600" speed="1.500000" hp="40" ac="1" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" fly="yes" walk="yes" teach="no" getitem="yes" unarmedguard="yes">
<ai splitsize="9999"/>
<function name="initfamiliar" value="oldfamiliars"/>
<skill name="alchemy" modifier="-99"/>
@ -733,7 +733,7 @@
<attack type="4" damage="2d12"/>
<attack type="4" damage="2d12"/>
</race>
<race name="wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" weight="18000" capacity="1000000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" weight="18000" capacity="1000000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="1" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="move" value="movedragon"/>
@ -745,7 +745,7 @@
<attack type="4" damage="5d30"/>
<attack type="6" spell="powerful_dragonbreath" level="12" />
</race>
<race name="dragon" magres="0.700000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="10000" capacity="1000000" speed="1.500000" hp="900" ac="6" damage="2d30" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="dragon" magres="0.700000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="10000" capacity="1000000" speed="1.500000" hp="900" ac="6" damage="2d30" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="2" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agedragon"/>
@ -758,7 +758,7 @@
<attack type="4" damage="3d30"/>
<attack type="6" spell="icy_dragonbreath" level="6" />
</race>
<race name="youngdragon" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="10000" weight="20000" capacity="10000" speed="1.000000" hp="300" ac="4" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="youngdragon" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="10000" weight="20000" capacity="10000" speed="1.000000" hp="300" ac="4" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="6" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agefiredragon"/>
@ -1170,7 +1170,7 @@
<function name="name" value="namegeneric"/>
<attack type="1" damage="1d1"/>
</race>
<race name="seaserpent" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="5000" weight="20000" capacity="5000" speed="1.000000" hp="600" ac="3" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" swim="yes" teach="no" getitem="yes" resistbash="yes">
<race name="seaserpent" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="5000" weight="20000" capacity="5000" speed="1.000000" hp="600" ac="3" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" swim="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="6" killpeasants="yes" moverandom="yes" learn="yes"/>
<function name="name" value="namegeneric"/>
<function name="move" value="moveswimming"/>

View File

@ -27,7 +27,7 @@
<entry spell="summon_familiar" level="9" />
<entry spell="song_of_slavery" level="13" />
<entry spell="cerddor_destroymagic" level="8" />
<entry spell="cerrdorfumbleshield" level="5" />
<entry spell="cerddorfumbleshield" level="5" />
<entry spell="big_recruit" level="14" />
<entry spell="raindance" level="3" />
<entry spell="create_roi" level="6" />

View File

@ -26,7 +26,7 @@
<entry spell="calm_monster" level="6" />
<entry spell="calm_riot" level="15" />
<entry spell="cerddor_destroymagic" level="8" />
<entry spell="cerrdorfumbleshield" level="5" />
<entry spell="cerddorfumbleshield" level="5" />
<entry spell="chaosrow" level="8" />
<entry spell="chaossuction" level="14" />
<entry spell="clone" level="9" />

View File

@ -304,6 +304,9 @@
<spell name="wolfhowl" rank="5" index="94" variable="true" combat="1">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="igjarjuk" rank="5" index="94" variable="true" combat="1">
<function name="cast" value="igjarjuk"/>
</spell>
<spell name="resist_magic" rank="2" index="97" parameters="u+" los="true" ship="true" variable="true">
<resource name="aura" amount="5" cost="level"/>
</spell>
@ -402,7 +405,7 @@
<spell name="gwyrrdfumbleshield" rank="2" index="144" variable="true" combat="1">
<resource name="aura" amount="5" cost="level"/>
</spell>
<spell name="cerrdorfumbleshield" rank="2" index="145" variable="true" combat="1">
<spell name="cerddorfumbleshield" rank="2" index="145" variable="true" combat="1">
<resource name="aura" amount="5" cost="level"/>
</spell>
<spell name="tybiedfumbleshield" rank="2" index="146" variable="true" combat="1">

View File

@ -1,17 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<strings>
<namespace name="spellinfo">
<string name="concealing_aura">
<text locale="de">Dieser Zauber wird die gesamte Ausrüstung der
Zieleinheit für
einige Zeit vor den Blicken anderer verschleiern. Der
Zauber
schützt nicht vor Dieben und Spionen.</text>
<text locale="en">This spell will hide the whole equipment of a target
unit from the
looks of others. It will not protect against thieves or
spies.</text>
</string>
<string name="headache">
<text locale="de">
Aufzeichung des Vortrags von Selen Ard'Ragorn in Bar'Glingal:

View File

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<terrains>
<!-- used by the experimental dungeon -->
<terrain name="hell" fly="no" sail="no" size="0" land="no"/>
<!-- used for the museum only -->
<terrain name="hall1" fly="no" size="0" />
<terrain name="corridor1" fly="no" size="0" />
<terrain name="wall1" sail="no" walk="no" fly="no" forbidden="yes" size="0" />
</terrains>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" ?>
<terrains>
<!-- defaults: walk="yes" sail="yes" fly="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" size="0" -->
<terrain name="ocean" size="100" walk="no" swim="yes" land="no" sea="yes" />
<terrain name="plain" size="4000" road="50" forest="yes" cavalry="yes" seed="3">
<resource name="iron" chance="0.1" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.15" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.01" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="swamp" size="1200" road="75" seed="2">
<resource name="iron" chance="0.02" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.02" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.02" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="desert" size="400" road="100" cavalry="yes" seed="2">
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="highland" size="2300" road="100" cavalry="yes" seed="2">
<resource name="iron" chance="0.15" level="2d4-1" base="5d8" div="2d20+10" />
<resource name="stone" chance="0.25" level="1d4" base="5d8" div="2d30+20" />
<resource name="laen" chance="0.025" level="1d4" base="1d4" div="2d20+50" />
</terrain>
<terrain name="mountain" size="600" road="250" seed="2">
<resource name="iron" chance="1.0" level="1" base="50" div="50" />
<resource name="stone" chance="1.0" level="1" base="100" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="glacier" size="150" road="250" arctic="yes" seed="2">
<resource name="iron" chance="1.0" level="1" base="3" div="50" />
<resource name="stone" chance="1.0" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg_sleep" size="150" road="250" arctic="yes">
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
<resource name="laen" chance="0.05" level="1" base="4" div="100" />
</terrain>
<terrain name="iceberg" size="150" arctic="yes">
<resource name="iron" chance="0.9" level="1" base="3" div="50" />
<resource name="stone" chance="0.9" level="1" base="2" div="100" />
</terrain>
<terrain name="firewall" road="250" land="no" walk="no" sail="no" fly="no" forbidden="yes" />
<terrain name="fog" sail="no" land="no" />
<terrain name="thickfog" forbidden="yes" sail="no" walk="no" fly="no" land="no" />
<terrain name="volcano" size="400" road="250" seed="1">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
<terrain name="activevolcano" size="400" road="250">
<resource name="iron" chance="0.5" level="1" base="50" div="50" />
<resource name="stone" chance="0.5" level="1" base="100" div="100" />
<resource name="laen" chance="0.075" level="1" base="4" div="100" />
</terrain>
</terrains>

24
s/build
View File

@ -4,12 +4,8 @@ while [ ! -d $ROOT/.git ]; do
ROOT=`dirname $ROOT`
done
[ -z $BUILD ] && BUILD=Debug
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-$BUILD"
[ -z "$CC" ] && CC=clang
[ -z "$BUILD" ] && BUILD=Debug
[ -z "$JOBS" ] && [ "" != "which nproc" ] && JOBS=`nproc`
DISTCC=`which distcc`
@ -22,13 +18,21 @@ CC="$DISTCC $CC"
MAKEOPTS=-j$JOBS
fi
fi
echo "Building with $CC and $JOBS jobs"
echo "Building with CC=$CC and $JOBS jobs"
if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
if [ ! -d $ROOT/$BUILD ]; then
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
exit
fi
cd $ROOT/$BIN_DIR
git submodule update
if [ -z `which tolua` ]; then
echo "build tolua"
cd $ROOT/tolua ; make
fi
echo "build eressea"
cd $ROOT/$BUILD
make $MAKEOPTS && make test
cd $OLDPWD

View File

@ -10,13 +10,13 @@ done
[ -z $BUILD ] && BUILD=Debug
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="clang"
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-$BUILD"
BIN_DIR="$ROOT/build-$MACHINE-$CC-$BUILD"
mkdir -p $BIN_DIR
ln -sf $BIN_DIR $BUILD
cd $BIN_DIR
MACHINE=$(gcc -dumpmachine)
rm -f CMakeCache.txt
@ -33,12 +33,26 @@ if [ -d $HOME/usr ]; then
PREFIX_PATH=$HOME/usr:$HOME/usr/local:$PREFIX_PATH
fi
cmake .. \
-DCMAKE_MODULE_PATH=$PWD/../cmake/Modules \
ARGS=" -DCMAKE_MODULE_PATH=$ROOT/cmake/Modules \
-DCMAKE_BUILD_TYPE=$BUILD \
-DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \
-DCMAKE_INCLUDE_PATH=$INCLUDE_PATH \
-DCMAKE_PREFIX_PATH=$PREFIX_PATH \
-DCMAKE_INSTALL_PREFIX=$HOME/eressea/server $*
-DCMAKE_INSTALL_PREFIX=$HOME/eressea/server"
path="$(which tolua)"
if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
echo "tolua is not installed, building from source"
cd $ROOT/tolua ; make
ARGS="$ARGS -DPC_TOLUA_DIR=$ROOT/tolua"
else
echo "tolua is $path"
fi
unset path
set -e
cd $BIN_DIR
cmake .. $ARGS $*
cd $OLDPWD

View File

@ -2,7 +2,7 @@
ROOT=$(pwd)
while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
if [ "$ROOT" == "/" ; then
if [ "/" = "$ROOT" ]; then
echo "could not find root, are you in the git repository?"
exit
fi
@ -21,8 +21,12 @@ make install
[ -d $DEST/bin ] || mkdir -p $DEST/bin
install -v $ROOT/process/cron/*.cron $DEST/bin/
programs="create-orders backup-eressea run-turn"
programs="create-orders backup-eressea run-turn send-zip-report send-bz2-report compress.py compress.sh"
for prg in ${programs} ; do
install -v $ROOT/process/$prg $DEST/bin/
done
crontab $ROOT/process/cron/crontab
# install crontab, but only on the eressea server:
# in fact, never do this, because it overwrites hand-edits
#WHOAMI=`whoami`@`hostname`
#[ "eressea@gruenbaer" = "$WHOAMI" ] && crontab $ROOT/process/cron/crontab

View File

@ -24,6 +24,7 @@ assert_dir $SOURCE
cd $SOURCE
git fetch || abort "failed to update source. do you have local changes?"
[ -z $1 ] || git checkout $1
git pull
git submodule update
s/build || abort "build failed."
}
@ -80,10 +81,11 @@ ln -f $LIVE/data/$turn.dat data/
rm -rf reports
mkdir -p reports
SERVER="$SOURCE/build-x86_64-gcc-Debug/eressea/eressea"
SUPP="$SOURCE/share/ubuntu-12_04.supp"
SERVER="$SOURCE/Debug/eressea/eressea"
VALGRIND=$(which valgrind)
if [ ! -z $VALGRIND ]; then
SERVER="$VALGRIND --leak-check=no $SERVER"
SERVER="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
fi
$SERVER -v$verbose -t$turn -re$game $SOURCE/scripts/run-turn.lua
let turn=$turn+1
@ -147,7 +149,7 @@ case "$1" in
;;
"run")
if [ $turn -eq 0 ]; then
[ -f $LIVE/turn ] || abort "missing turn file, and no turn specified"
[ -f $LIVE/turn ] || abort "missing turn file in $LIVE, and no turn specified"
let turn=$(cat $LIVE/turn)-1
fi
run

21
s/release Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
import os
import sys
template="""#define VERSION_MAJOR %s
#define VERSION_MINOR %s
#define VERSION_BUILD %s
"""
def new_version(ver):
sp = ver.split(".")
sp = (sp[0], sp[1], sp[2])
file = open("src/buildno.h", "w")
file.write(template % sp)
file.close()
os.system("git add src/buildno.h")
os.system("git commit -m 'release version %s'" % ver)
os.system("git tag -f v%s" % ver)
new_version(sys.argv[1])

View File

@ -6,22 +6,20 @@ while [ ! -d $ROOT/.git ]; do
ROOT=$(dirname $ROOT)
done
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BIN_DIR="build-$MACHINE-$CC-Debug"
[ -z $BUILD ] && BUILD=Debug ; export BUILD
if [ ! -d $ROOT/$BIN_DIR ]; then
echo "cannot find build directory $BIN_DIR in $ROOT. did you run cmake-init?"
if [ ! -e $ROOT/$BUILD ]; then
echo "cannot find build directory $BUILD in $ROOT. did you run cmake-init?"
exit
fi
$ROOT/$BIN_DIR/eressea/test_eressea
$ROOT/$BUILD/eressea/test_eressea
cd $ROOT
[ -e eressea.ini ] || ln -sf conf/eressea.ini
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests.lua
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests-e2.lua
$ROOT/$BIN_DIR/eressea/eressea -v0 scripts/run-tests-e3.lua
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests.lua
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e4.lua
rm -rf data reports orders.txt
cd $OLDWPD

View File

@ -1,12 +1,6 @@
#!/bin/sh
set -e
ROOT=`pwd`
MACHINE=`uname -m`
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
BUILD="$ROOT/build-$MACHINE-$CC-Debug"
inifile() {
cd $ROOT
@ -16,48 +10,13 @@ $BUILD/iniparser/inifile eressea.ini add lua:paths lunit:scripts
fi
}
build() {
cd $BUILD
cmake -DCMAKE_MODULE_PATH=$ROOT/cmake/Modules -DCMAKE_BUILD_TYPE=Debug ..
make
}
test_valgrind_report () {
cd tests
ln -sf ../scripts/config.lua
valgrind --suppressions=ubuntu-12_04.supp --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua
}
test_unittests() {
$BUILD/eressea/test_eressea
}
cleanup() {
cd $ROOT/tests
rm -rf reports score eressea.log* config.lua
}
test_server() {
set -e
[ -z $BUILD ] && BUILD=Debug ; export BUILD
s/cmake-init
s/build
cd $ROOT
inifile
$BUILD/eressea/eressea -v0 scripts/run-tests.lua
$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua
$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua
}
# information
echo "* base directory: $ROOT"
echo "* build directory: $BUILD"
echo "* lsb_release:"
lsb_release -a
echo "* zlib1g-dev package:"
dpkg -l zlib1g-dev
echo
# build the code
[ -d $BUILD ] || mkdir $BUILD
build
test_unittests
test_server
test_valgrind_report
cleanup
s/runtests
cd tests
./write-reports.sh
./run-turn.sh

View File

@ -0,0 +1,29 @@
local function bitset(flags, bit)
-- TODO: use bit32 when we no longer have to consider lua 5.1 compatibility
local x = flags % (bit*2)
return x >= bit
end
local function curse(file)
for line in file:lines() do
f = get_faction(line)
if not f then
print("no such faction: " .. line)
elseif not bitset(f.flags, 16) then
print("cursing " .. tostring(f))
f.flags = f.flags + 16
end
end
end
local cursed = {}
function cursed.init()
local f = io.open("cursed.txt", "r")
if f then
print("found cursed.txt")
curse(f)
end
end
return cursed

View File

@ -14,5 +14,6 @@ return {
require('eressea.astral'),
require('eressea.locales'),
require('eressea.jsreport'),
require('eressea.ents')
require('eressea.ents'),
require('eressea.cursed')
}

View File

@ -16,7 +16,7 @@ end
local function repair_ents(r)
for u in r.units do
if u.faction.id==666 and u.race == "undead" and u.name == "Wütende Ents" then
print("ent repair", u)
eressea.log.info("ent repair: " .. tostring(u))
u.race = "ent"
end
end

View File

@ -1,9 +1,7 @@
local pkg = {}
print("loading jsreport module")
function pkg.init()
eressea.settings.set("feature.jsreport.enable", "1")
eressea.settings.set("jsreport.enabled", "1")
end
function pkg.update()

View File

@ -1,53 +0,0 @@
require "lunit"
module("tests.eressea.attrib", package.seeall, lunit.testcase)
function has_attrib(u, value)
for a in u.attribs do
if (a.data==value) then return true end
end
return false
end
function test_attrib_global()
a = attrib.create('global', {})
eressea.write_game('attrib.dat')
eressea.free_game()
eressea.read_game('attrib.dat')
end
function test_attrib()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
data = { arr = { 'a', 'b', 'c' }, name = 'familiar', events = { die = 'familiar_died' }, data = { mage = u2 } }
a = { 'a' }
b = { 'a' }
uno = u.id
u2no = u2.id
a = attrib.create(u, 12)
a = attrib.create(u, "enno")
a = attrib.create(u, u2)
a = attrib.create(u, data)
eressea.write_game("attrib.dat")
eressea.free_game()
eressea.read_game("attrib.dat")
u = get_unit(uno)
u2 = get_unit(u2no)
assert_false(has_attrib(u, 42))
assert_true(has_attrib(u, "enno"))
assert_true(has_attrib(u, 12))
for a in u.attribs do
x = a.data
if (type(x)=="table") then
assert_equal('a', x.arr[1])
assert_equal('familiar', x.name)
assert_equal('familiar_died', x.events.die)
assert_equal(u2, x.data.mage)
break
end
end
end

View File

@ -1,65 +0,0 @@
require "lunit"
module("tests.eressea.bson", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
end
function test_bson_create()
local a = attrib.create("global", 12)
assert_not_equal(nil, a)
for a in attrib.get("global") do
assert_equal(a.data, 12)
end
end
function test_illegal_arg()
local a = attrib.create(nil, 42)
assert_equal(nil, a)
a = attrib.create("fred", 42)
assert_equal(nil, a)
end
function test_bson_readwrite()
local i, r = region.create(0, 0, "mountain")
attrib.create(r, 42)
i = eressea.write_game("test_read_write.dat")
assert_equal(0, i)
eressea.free_game()
r = get_region(0, 0)
assert_equal(nil, r)
i = eressea.read_game("test_read_write.dat")
assert_equal(0, i)
r = get_region(0, 0)
assert_not_equal(nil, r)
for a in attrib.get(r) do
assert_equal(a.data, 42)
end
end
function test_bson()
local r = region.create(0, 0, "mountain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
assert_not_equal(nil, u)
assert_not_equal(nil, r)
assert_not_equal(nil, f)
attrib.create(r, 1)
assert_equal(attrib.get(r)().data, 1)
attrib.create(u, 3)
assert_equal(attrib.get(u)().data, 3)
attrib.create(f, 5)
assert_equal(attrib.get(f)().data, 5)
end
function test_bson_with_multiple_attribs()
local r = region.create(0, 0, "mountain")
attrib.create(r, { a=1})
attrib.create(r, { a=5})
local total = 0
for a in attrib.get(r) do
total = total + a.data.a;
end
assert_equal(6, total)
end

View File

@ -1,27 +0,0 @@
require "lunit"
module('tests.eressea.castles', package.seeall, lunit.testcase )
function setup()
eressea.free_game()
end
function test_small_castles()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
local f2 = faction.create("noreply@eressea.de", "halfling", "de")
local u2 = unit.create(f2, r, 1)
u1:add_item("money", 10000)
local b = building.create(r, "castle")
u2.building = b
u1.building = b
b.owner = u2
assert_equal("site", b:get_typename(7))
assert_equal("fortification", b:get_typename(8))
b.owner = u1
assert_equal("site", b:get_typename(9))
assert_equal("fortification", b:get_typename(10))
end

View File

@ -1,39 +0,0 @@
require "lunit"
module("tests.eressea.config", package.seeall, lunit.testcase )
function setup()
eressea.free_game()
end
function test_read_race()
local f
eressea.free_game()
f = faction.create("orc@example.com", "orc", "en")
assert_equal(nil, f)
assert_not_nil(eressea.config)
eressea.config.parse('{ "races": { "orc" : {}}}')
f = faction.create("orc@example.com", "orc", "en")
assert_not_nil(f)
end
function test_read_ship()
local s
eressea.free_game()
s = ship.create(nil, "boat")
assert_equal(nil, s)
assert_not_nil(eressea.config)
conf = [[{
"ships": {
"boat" : {
"construction" : {
"maxsize" : 20
}
}
}
}]]
eressea.config.parse(conf);
s = ship.create(nil, "boat")
assert_not_nil(s)
end

View File

@ -1,735 +0,0 @@
require "lunit"
module("tests.e3.e3features", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("rules.economy.food", "4")
end
function test_no_stealth()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:set_skill("stealth", 1)
assert_equal(-1, u:get_skill("stealth"))
u:clear_orders()
u:add_order("LERNEN TARNUNG")
process_orders()
assert_equal(-1, u:get_skill("stealth"))
end
--[[
function test_analyze_magic()
local r1 = region.create(0,0, "plain")
local r2 = region.create(1,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r2, 1)
u.race = "elf"
u:set_skill("magic", 6)
u.magic = "gwyrrd"
u.aura = 60
u:add_spell("analyze_magic")
u:clear_orders()
u:add_order("Zaubere stufe 2 'Magie analysieren' REGION 1,0")
process_orders()
end
]]--
function test_seecast()
local r = region.create(0,0, "plain")
for i = 1,10 do
-- this prevents storms (only high seas have storms)
region.create(i, 1, "plain")
end
for i = 1,10 do
region.create(i, 0, "ocean")
end
local f = faction.create("noreply@eressea.de", "human", "de")
local s1 = ship.create(r, "cutter")
local u1 = unit.create(f, r, 2)
u1:set_skill("sailing", 3)
u1:add_item("money", 1000)
u1.ship = s1
local u2 = unit.create(f, r, 1)
u2.race = "elf"
u2:set_skill("magic", 6)
u2.magic = "gwyrrd"
u2.aura = 60
u2.ship = s1
u2:add_spell("stormwinds")
update_owners()
u2:clear_orders()
u2:add_order("Zaubere stufe 2 'Beschwoere einen Sturmelementar' " .. itoa36(s1.id))
u1:clear_orders()
u1:add_order("NACH O O O O")
process_orders()
assert_equal(4, u2.region.x)
u2:clear_orders()
u2:add_order("Zaubere stufe 2 'Beschwoere einen Sturmelementar' " .. itoa36(s1.id))
u1:clear_orders()
u1:add_order("NACH O O O O")
process_orders()
assert_equal(8, u2.region.x)
end
local function use_tree(terrain)
local r = region.create(0,0, terrain)
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 5)
r:set_resource("tree", 0)
u1:add_item("xmastree", 1)
u1:clear_orders()
u1:add_order("BENUTZEN 1 Weihnachtsbaum")
process_orders()
return r
end
function test_xmas2009()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 1)
process_orders()
xmas2009()
assert_equal("xmastree", f.items())
end
function test_xmastree()
local r
r = use_tree("ocean")
assert_equal(0, r:get_resource("tree"))
eressea.free_game()
r = use_tree("plain")
assert_equal(10, r:get_resource("tree"))
end
function test_fishing()
eressea.settings.set("rules.economy.food", "0")
local r = region.create(0,0, "ocean")
local r2 = region.create(1,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local s1 = ship.create(r, "cutter")
local u1 = unit.create(f, r, 3)
u1.ship = s1
u1:set_skill("sailing", 10)
u1:add_item("money", 100)
u1:clear_orders()
u1:add_order("NACH O")
update_owners()
process_orders()
assert_equal(r2, u1.region)
assert_equal(90, u1:get_item("money"))
u1:clear_orders()
u1:add_order("NACH W")
process_orders()
assert_equal(r, u1.region)
assert_equal(60, u1:get_item("money"))
end
function test_ship_capacity()
eressea.settings.set("rules.ship.drifting", "0")
eressea.settings.set("rules.ship.storms", "0")
local r = region.create(0,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "goblin", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "cutter")
local u1 = unit.create(f, r, 5)
u1.ship = s1
u1:set_skill("sailing", 10)
u1:add_item("sword", 55)
u1:clear_orders()
u1:add_order("NACH O O")
-- u2 has too many people
local s2 = ship.create(r, "cutter")
local u2 = unit.create(f, r, 6)
u2.ship = s2
u2:set_skill("sailing", 10)
u2:clear_orders()
u2:add_order("NACH O O")
-- u3 has goblins, they weigh 40% less
local s3 = ship.create(r, "cutter")
local u3 = unit.create(f2, r, 8)
u3.ship = s3
u3:set_skill("sailing", 10)
u3:add_item("sword", 55)
u3:clear_orders()
u3:add_order("NACH O O")
-- u4 has too much stuff
local s4 = ship.create(r, "cutter")
local u4 = unit.create(f, r, 5)
u4.ship = s4
u4:set_skill("sailing", 10)
u4:add_item("sword", 56)
u4:clear_orders()
u4:add_order("NACH O O")
update_owners()
process_orders()
if r2~=u1.region then
print(get_turn(), u1, u1.faction)
write_reports()
end
assert_equal(r2, u1.region)
assert_not_equal(r2.id, u2.region.id)
if r2~=u3.region then
print(get_turn(), u3, u3.faction)
write_reports()
end
assert_equal(r2, u3.region)
assert_not_equal(r2.id, u4.region.id)
end
function test_owners()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u2 = unit.create(f2, r, 1)
local u3 = unit.create(f2, r, 1)
local b3 = building.create(r, "castle")
b3.size = 2
u3.building = b3
local b1 = building.create(r, "castle")
b1.size = 1
u1.building = b1
local b2 = building.create(r, "castle")
b2.size = 2
u2.building = b2
update_owners()
assert(r.owner==u3.faction)
b1.size=3
b2.size=3
update_owners()
assert(r.owner==u2.faction)
b1.size=4
update_owners()
assert(r.owner==u1.faction)
end
function test_taxes()
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 1000)
r:set_resource("money", 5000)
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:clear_orders()
u:add_order("LERNE Holzfaellen") -- do not work
local b = building.create(r, "watch")
b.size = 10
u.building = b
update_owners()
assert_equal(1, r.morale)
process_orders()
assert_equal(1, r.morale)
assert_equal(25, u:get_item("money"))
end
function test_region_owner_cannot_leave_castle()
eressea.settings.set("rules.move.owner_leave", "1")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
f.id = 42
local b1 = building.create(r, "castle")
b1.size = 10
local b2 = building.create(r, "lighthouse")
b2.size = 10
local u = unit.create(f, r, 1)
u.building = b1
u:add_item("money", u.number * 100)
u:clear_orders()
u:add_order("BETRETE BURG " .. itoa36(b2.id))
process_orders()
init_reports()
write_report(u.faction)
assert_equal(b1, u.building, "region owner has left the building") -- region owners may not leave
end
function test_market()
-- if i am the only trader around, i should be getting all the herbs from all 7 regions
local herb_multi = 500 -- from rc_herb_trade()
local r, idx
local herbnames = { 'h0', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h7', 'h8' }
idx = 1
for x = -1, 1 do for y = -1, 1 do
r = region.create(x, y, "plain")
r:set_resource("peasant", herb_multi * 9 + 50) -- 10 herbs per region
r.herb = herbnames[idx]
idx = idx+1
end end
r = get_region(0, 0)
local b = building.create(r, "market")
b.size = 10
local f = faction.create("noreply@eressea.de", "human", "de")
f.id = 42
local u = unit.create(f, r, 1)
u.building = b
u:add_item("money", u.number * 10000)
for i = 0, 5 do
local rn = r:next(i)
end
b.working = true
eressea.process.markets()
u:add_item("money", -u:get_item("money")) -- now we only have herbs
local len = 0
for i in u.items do
len = len + 1
end
assert_not_equal(0, len, "trader did not get any herbs")
for idx, name in pairs(herbnames) do
local n = u:get_item(name)
if n>0 then
assert_equal(10, n, 'trader did not get exaxtly 10 herbs')
end
end
end
function test_market_gives_items()
local r
for x = -1, 1 do for y = -1, 1 do
r = region.create(x, y, "plain")
r:set_resource("peasant", 5000)
end end
r = get_region(0, 0)
local b = building.create(r, "market")
b.size = 10
local f = faction.create("noreply@eressea.de", "human", "de")
f.id = 42
local u = unit.create(f, r, 1)
u.building = b
u:add_item("money", u.number * 10000)
for i = 0, 5 do
local rn = r:next(i)
end
process_orders()
local len = 0
for i in u.items do
len = len + 1
end
assert(len>1)
end
function test_spells()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u.race = "elf"
u:clear_orders()
u:add_item("money", 10000)
u:set_skill("magic", 5)
u:add_order("LERNE MAGIE Illaun")
process_orders()
local sp
local nums = 0
if f.spells~=nil then
for sp in f.spells do
nums = nums + 1
end
assert(nums>0)
for sp in u.spells do
nums = nums - 1
end
assert(nums==0)
elseif u.spells~=nil then
for sp in u.spells do
nums = nums + 1
end
assert(nums>0)
end
end
function test_alliance()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
u1:add_item("money", u1.number * 100)
local f2 = faction.create("info@eressea.de", "human", "de")
local u2 = unit.create(f2, r, 1)
u2:add_item("money", u2.number * 100)
assert(f1.alliance==nil)
assert(f2.alliance==nil)
u1:clear_orders()
u2:clear_orders()
u1:add_order("ALLIANZ NEU pink")
u1:add_order("ALLIANZ EINLADEN " .. itoa36(f2.id))
u2:add_order("ALLIANZ BEITRETEN pink")
process_orders()
assert(f1.alliance~=nil)
assert(f2.alliance~=nil)
assert(f2.alliance==f1.alliance)
u1:clear_orders()
u2:clear_orders()
u1:add_order("ALLIANZ KOMMANDO " .. itoa36(f2.id))
process_orders()
assert(f1.alliance~=nil)
assert(f2.alliance~=nil)
assert(f2.alliance==f1.alliance)
for f in f1.alliance.factions do
assert_true(f.id==f1.id or f.id==f2.id)
end
u1:clear_orders()
u2:clear_orders()
u2:add_order("ALLIANZ AUSSTOSSEN " .. itoa36(f1.id))
process_orders()
assert(f1.alliance==nil)
assert(f2.alliance~=nil)
u1:clear_orders()
u2:clear_orders()
u2:add_order("ALLIANZ NEU zing")
u1:add_order("ALLIANZ BEITRETEN zing") -- no invite!
process_orders()
assert(f1.alliance==nil)
assert(f2.alliance~=nil)
u1:clear_orders()
u2:clear_orders()
u1:add_order("ALLIANZ NEU zack")
u1:add_order("ALLIANZ EINLADEN " .. itoa36(f2.id))
u2:add_order("ALLIANZ BEITRETEN zack")
process_orders()
assert(f1.alliance==f2.alliance)
assert(f2.alliance~=nil)
end
function test_canoe_passes_through_land()
local f = faction.create("noreply@eressea.de", "human", "de")
local src = region.create(0, 0, "ocean")
local land = region.create(1, 0, "plain")
region.create(2, 0, "ocean")
local dst = region.create(3, 0, "ocean")
local sh = ship.create(src, "canoe")
local u1 = unit.create(f, src, 1)
local u2 = unit.create(f, src, 1)
u1.ship = sh
u2.ship = sh
u1:set_skill("sailing", 10)
u1:clear_orders()
u1:add_order("NACH O O O")
process_orders()
assert_equal(land, u2.region, "canoe did not stop at coast")
u1:add_order("NACH O O O")
process_orders()
assert_equal(dst, sh.region, "canoe could not leave coast")
assert_equal(dst, u1.region, "canoe could not leave coast")
assert_equal(dst, u2.region, "canoe could not leave coast")
end
function test_give_50_percent_of_money()
local r = region.create(0, 0, "plain")
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
u2:add_item("money", 500)
local m1, m2 = u1:get_item("money"), u2:get_item("money")
u1:clear_orders()
u1:add_order("GIB " .. itoa36(u2.id) .. " 221 Silber")
u2:clear_orders()
u2:add_order("LERNEN Hiebwaffen")
process_orders()
assert_equal(m1, u1:get_item("money"))
assert_equal(m2, u2:get_item("money"))
m1, m2 = u1:get_item("money"), u2:get_item("money")
u1:clear_orders()
u1:add_order("GIB " .. itoa36(u2.id) .. " 221 Silber")
u2:clear_orders()
u2:add_order("HELFEN " .. itoa36(u1.faction.id) .. " GIB")
u2:add_item("horse", 100)
u2:add_order("GIB 0 ALLES PFERD")
local h = r:get_resource("horse")
process_orders()
assert_true(r:get_resource("horse")>=h+100)
assert_equal(m1-221, u1:get_item("money"))
assert_equal(m2+110, u2:get_item("money"))
end
function test_give_100_percent_of_items()
r = region.create(0, 0, "plain")
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
u1:add_item("log", 500)
local m1, m2 = u1:get_item("log"), u2:get_item("log")
u1:clear_orders()
u1:add_order("GIB " .. itoa36(u2.id) .. " 332 Holz")
u2:clear_orders()
u2:add_order("LERNEN Hiebwaffen")
u2:add_order("HELFEN " .. itoa36(u1.faction.id) .. " GIB")
process_orders()
assert_equal(m1-332, u1:get_item("log"))
assert_equal(m2+332, u2:get_item("log"))
end
function test_cannot_give_person()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
u2:add_item("money", 500)
u2:clear_orders()
u2:add_order("GIB ".. itoa36(u1.id) .. " 1 PERSON")
u2:add_order("HELFE ".. itoa36(f1.id) .. " GIB")
u1:add_order("HELFE ".. itoa36(f2.id) .. " GIB")
process_orders()
assert_equal(10, u2.number)
assert_equal(10, u1.number)
end
function test_cannot_give_unit()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
u2:add_item("money", 500)
u2:clear_orders()
u2:add_order("GIB ".. itoa36(u1.id) .. " EINHEIT")
u2:add_order("HELFE ".. itoa36(f1.id) .. " GIB")
u1:add_order("HELFE ".. itoa36(f2.id) .. " GIB")
process_orders()
assert_not_equal(u2.faction.id, u1.faction.id)
end
function test_guard_by_owners()
-- http://bugs.eressea.de/view.php?id=1756
local r = region.create(0,0, "mountain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
f1.age=20
local f2 = faction.create("noreply@eressea.de", "human", "de")
f2.age=20
local u1 = unit.create(f1, r, 1)
local b = building.create(r, "castle")
b.size = 10
u1.building = b
u1:add_item("money", 100)
local u2 = unit.create(f2, r, 1)
u2:add_item("money", 100)
u2:set_skill("mining", 3)
u2:clear_orders()
u2:add_order("MACHEN EISEN")
process_orders()
local iron = u2:get_item("iron")
process_orders()
assert_equal(iron, u2:get_item("iron"))
end
function test_market_action()
local f = faction.create("noreply@eressea.de", "human", "de")
local x, y, r
for x=0,2 do
for y=0,2 do
r = region.create(x, y, "plain")
r.luxury = "balm"
r.herb = "h2"
r:set_resource("peasant", 5000)
end
end
r = get_region(1, 1)
local u = unit.create(f, r, 1)
b = building.create(r, "market")
b.size = 10
u.building = b
update_owners()
for r in regions() do
market_action(r)
end
assert_equal(35, u:get_item("balm"))
assert_equal(70, u:get_item("h2"))
end
local function setup_packice(x, onfoot)
local f = faction.create("noreply@eressea.de", "human", "de")
local plain = region.create(0,0, "plain")
local ice = region.create(1,0, "packice")
local ocean = region.create(2,0, "ocean")
local u = unit.create(f, get_region(x, 0), 2)
if not onfoot then
local s = ship.create(u.region, "cutter")
u:set_skill("sailing", 3)
u.ship = s
end
u:add_item("money", 400)
return u
end
function test_no_sailing_through_packice()
local u = setup_packice(0)
u:clear_orders()
u:add_order("NACH O O")
process_orders()
assert_equal(0, u.region.x)
end
function test_can_sail_from_packice_to_ocean()
local u = setup_packice(1)
u:clear_orders()
u:add_order("NACH W")
process_orders()
assert_equal(1, u.region.x)
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(2, u.region.x)
end
function test_can_sail_into_packice()
local u = setup_packice(2)
u:clear_orders()
u:add_order("NACH W W")
process_orders()
assert_equal(1, u.region.x)
end
function test_can_walk_into_packice()
local u = setup_packice(0, true)
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(1, u.region.x)
end
function test_cannot_walk_into_ocean()
local u = setup_packice(1, true)
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(1, u.region.x)
end
function test_p2()
local f = faction.create("noreply@eressea.de", "human", "de")
local r = region.create(0, 0, "plain")
local u = unit.create(f, r, 1)
r:set_resource("tree", 0)
u:clear_orders()
u:add_order("BENUTZE 'Wasser des Lebens'")
u:add_item("p2", 1)
u:add_item("log", 10)
u:add_item("mallorn", 10)
process_orders()
assert_equal(5, r:get_resource("tree"))
assert_equal(0, u:get_item("p2"))
assert_equal(15, u:get_item("log") + u:get_item("mallorn"))
end
function test_p2_move()
-- http://bugs.eressea.de/view.php?id=1855
local f = faction.create("noreply@eressea.de", "human", "de")
local r = region.create(0, 0, "plain")
region.create(1, 0, "plain")
local u = unit.create(f, r, 1)
r:set_resource("tree", 0)
u:clear_orders()
u:add_order("BENUTZE 'Wasser des Lebens'")
u:add_order("NACH OST")
u:add_item("horse", 1)
u:add_item("p2", 1)
u:add_item("log", 1)
u:add_item("mallorn", 1)
process_orders()
assert_equal(1, u.region.x)
assert_equal(1, r:get_resource("tree"))
end
function disabled_test_bug_1738_build_castle_e3()
local r = region.create(0, 0, "plain")
local f = faction.create("bug_1738@eressea.de", "human", "de")
local c = building.create(r, "castle")
c.size = 228
local u1 = unit.create(f, r, 1)
u1:set_skill("building", 5)
u1:add_item("stone", 10000)
local u2 = unit.create(f, r, 32)
u2:set_skill("building", 3)
u2:add_item("stone", 10000)
u1:clear_orders()
u1:add_order("MACHE BURG " .. itoa36(c.id))
-- castle now has size 229.
u2:clear_orders()
u2:add_order("MACHE BURG " .. itoa36(c.id))
-- 32 * 3 makes 96 skill points.
-- from size 229 to size 250 needs 21 * 3 = 63 points, rest 33.
-- 33/4 makes 8 points, resulting size is 258.
process_orders()
--[[
init_reports()
write_report(f)
]]--
-- resulting size should be 250 because unit 2
-- does not have the needed minimum skill.
assert_equal(c.size, 250)
end
function test_golem_use_four_iron()
local r0 = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "halfling", "de")
local u1 = unit.create(f1, r0, 3)
u1.race = "irongolem"
u1:set_skill("weaponsmithing", 1)
u1:set_skill("armorer", 1)
u1:clear_orders()
u1:add_order("Mache 4 Turmschild")
process_orders()
assert_equal(2, u1.number)
assert_equal(4, u1:get_item("towershield"))
end
function test_building_owner_can_enter_ship()
local r1 = region.create(1, 2, "plain")
local f1 = faction.create("noreply@tteessttiinngg.de", "human", "de")
local b1 = building.create(r1, "castle")
b1.size = 10
local s1 = ship.create(r1, "cutter")
local u1 = unit.create(f1, r1, 10)
u1.building = b1
u1:add_item("money", u1.number * 100)
u1:clear_orders()
u1:add_order("VERLASSEN")
u1:add_order("BETRETE SCHIFF " .. itoa36(s1.id))
local u2 = unit.create(f1, r1, 10)
u2.ship = s1
u2:add_item("money", u1.number * 100)
u2:clear_orders()
process_orders()
assert_equal(s1, u1.ship)
assert_equal(null, u1.building, "owner of the building can not go into a ship")
end

View File

@ -1,360 +0,0 @@
require "lunit"
module("tests.e3.e2features", package.seeall, lunit.testcase )
local function one_unit(r, f)
local u = unit.create(f, r, 1)
u:add_item("money", u.number * 100)
u:clear_orders()
return u
end
local function two_factions()
local f1 = faction.create("one@eressea.de", "human", "de")
local f2 = faction.create("two@eressea.de", "human", "de")
return f1, f2
end
local function two_units(r, f1, f2)
return one_unit(r, f1), one_unit(r, f2)
end
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.economy.food", "4")
end
function test_learn()
eressea.settings.set("study.random_progress", "0")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
f.age = 20
local u = unit.create(f, r)
u:clear_orders()
u:add_order("@LERNEN Reiten")
process_orders()
assert_equal(1, u:get_skill("riding"))
process_orders()
process_orders()
assert_equal(2, u:get_skill("riding"))
process_orders()
process_orders()
process_orders()
assert_equal(3, u:get_skill("riding"))
end
function test_teach()
eressea.settings.set("study.random_progress", "0")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
f.age = 20
local u = unit.create(f, r, 10)
local u2 = unit.create(f, r)
u:clear_orders()
u:add_order("@LERNEN reiten")
u2:clear_orders()
u2:add_order("LEHREN " .. itoa36(u.id))
u2:set_skill("riding", 4)
process_orders()
assert_equal(1, u:get_skill("riding"))
process_orders()
assert_equal(2, u:get_skill("riding"))
end
function test_rename()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r)
u:add_item("aoh", 1)
assert_equal(u:get_item("ao_healing"), 1)
end
function DISABLE_test_alp()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u.race = "elf"
u:set_skill("magic", 10)
u:add_item("money", 3010)
u.magic = "illaun"
u.aura = 200
u.ship = s1
u:add_spell("summon_alp")
u:clear_orders()
u:add_order("ZAUBERE 'Alp' " .. itoa36(u2.id))
process_orders()
print(get_turn(), f)
write_reports()
end
function test_unit_limit_is_1500()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
for i = 1,1500 do
unit.create(f, r, 1)
end
local u = unit.create(f, r, 0)
u:add_item("money", 20000)
u:clear_orders()
u:add_order("REKRUTIEREN 1")
process_orders()
assert_equal(1, u.number)
end
function test_ship_capacity()
local r = region.create(0,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "boat")
local u1 = unit.create(f, r, 5)
u1.ship = s1
u1:set_skill("sailing", 10)
u1:clear_orders()
u1:add_order("NACH O O")
-- u2 has too many people
local s2 = ship.create(r, "boat")
local u2 = unit.create(f, r, 6)
u2.ship = s2
u2:set_skill("sailing", 10)
u2:clear_orders()
u2:add_order("NACH O O")
-- u4 has too much stuff
local s4 = ship.create(r, "boat")
local u4 = unit.create(f, r, 5)
u4.ship = s4
u4:set_skill("sailing", 10)
u4:add_item("sword", 1)
u4:clear_orders()
u4:add_order("NACH O O")
process_orders()
-- print(s.region, u.region, r2)
assert_equal(r2, u1.region, "boat with 5 humans did not move")
assert_not_equal(r2, u2.region, "boat with too many people has moved")
assert_not_equal(r2, u4.region, "boat with too much cargo has moved")
end
function test_levitate()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 2)
local s = ship.create(r, "boat")
u.ship = s
u.age = 20
u:set_skill("sailing", 5)
u:add_item("money", 100)
u:clear_orders()
u:add_order("ARBEITE")
levitate_ship(u.ship, u, 2, 1)
assert_equal(32, u.ship.flags)
process_orders()
assert_equal(0, u.ship.flags)
end
function test_terrains()
local terrains = { "hell", "wall1", "corridor1" }
for k,v in ipairs(terrains) do
local r = region.create(k, k, v)
assert_not_equal(nil, r)
end
end
function test_races()
local races = { "wolf", "orc", "human", "demon" }
for k,v in ipairs(races) do
local f = faction.create("noreply@eressea.de", "human", "de")
assert_not_equal(nil, f)
end
end
function test_can_give_person()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
u2:add_item("money", 500)
u2:clear_orders()
u2:add_order("GIB ".. itoa36(u1.id) .. " 1 PERSON")
u2:add_order("HELFE ".. itoa36(f1.id) .. " GIB")
u1:add_order("HELFE ".. itoa36(f2.id) .. " GIB")
u1:add_order("KONTAKTIERE ".. itoa36(u2.id))
process_orders()
assert_equal(9, u2.number)
assert_equal(11, u1.number)
end
function test_no_uruk()
local f1 = faction.create("noreply@eressea.de", "uruk", "de")
assert_equal(f1.race, "orc")
end
function test_snowman()
local r = region.create(0, 0, "glacier")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("snowman", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Schneemann")
process_orders()
for u2 in r.units do
if u2.id~=u.id then
assert_equal(u2.race, "snowman")
u = nil
break
end
end
assert_equal(nil, u)
end
function test_block_movement()
eressea.settings.set("rules.guard.base_stop_prob", "0.3")
eressea.settings.set("rules.guard.amulet_stop_prob", "0.0")
eressea.settings.set("rules.guard.skill_stop_prob", "0.1")
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local f1, f2 = two_factions()
f1.age=20
f2.age=20
local u11 = one_unit(r1, f1)
local u2 = { }
for i = 1, 20 do
u2[i] = one_unit(r0, f2)
end
u11:add_item("sword", 1)
u11:add_item("money", 1)
u11:set_skill("melee", 1)
u11:set_skill("perception", 7)
u11:clear_orders()
u11:add_order("BEWACHEN")
process_orders()
for i, u in ipairs(u2) do
u:add_item("horse", 1)
u:set_skill("riding", 1)
u:clear_orders()
u:add_order("NACH o o")
end
u2[1]:set_skill("stealth", 8)
process_orders()
assert_equal(r2, u2[1].region, "nobody should see me")
for i, u in ipairs(u2) do
if i > 1 then
assert_equal(r1, u.region, "perception +7 should always stop me")
end
end
end
function test_block_movement_aots()
eressea.settings.set("rules.guard.base_stop_prob", "0.0")
eressea.settings.set("rules.guard.skill_stop_prob", "1.0")
eressea.settings.set("rules.guard.amulet_stop_prob", "1.1")
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local f1, f2 = two_factions()
f1.age=20
f2.age=20
local u11, u12 = two_units(r1, f1, f1)
local u21, u22 = two_units(r0, f2, f2)
for i, u in ipairs ({ u11, u12 }) do
u:add_item("sword", 1)
u:add_item("money", 1)
u:set_skill("melee", 1)
u:clear_orders()
u:add_order("BEWACHEN")
end
process_orders()
for i, u in ipairs ({ u21, u22 }) do
u:add_item("horse", 1)
u:set_skill("riding", 1)
u:clear_orders()
u:add_order("NACH o o")
end
u12:add_item("aots", 10)
u22:set_skill("stealth", 1)
process_orders()
assert_equal(r1, u21.region, "unit with amulet should stop me")
assert_equal(r2, u22.region, "nobody should see me")
end
function test_stonegolems()
local r0 = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "stonegolem", "de")
local u1 = unit.create(f1, r0, 1)
local u2 = unit.create(f1, r0, 2)
local c1 = building.create(r0, "castle")
c1.size = 226
u1:set_skill("building", 1)
u2:set_skill("building", 1)
-- test that no server crash occur
u1:clear_orders()
u1:add_order("Mache Burg")
process_orders()
assert_equal(0 ,u1.number, "There shoud be no Stone Golems")
-- end test server crash
-- test that Stone Golems build for four stones
u2:clear_orders()
u2:add_order("MACHE 4 BURG " .. itoa36(c1.id))
process_orders()
assert_equal(230, c1.size, "resulting size should be 230")
assert_equal(1 ,u2.number, "There shoud be one Stone Golems")
-- end test Stone Golems four stones
end
function test_only_building_owner_can_set_not_paid()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
local mine = building.create(r, "mine")
mine.size = 2
u1:add_item("money", 500)
u1.building = mine
u2.building = mine
u1:clear_orders()
u2:clear_orders()
-- Test that Bezahle nicht is working
u1:add_order("Bezahle nicht")
process_orders()
assert_equal(500, u1:get_item("money"))
u1:clear_orders()
-- Test that bug fix 0001976 is working
-- Bezahle nicht is not working
u2:add_order("Bezahle nicht")
process_orders()
assert_equal(0, u1:get_item("money"))
end

View File

@ -1,16 +0,0 @@
-- require 'eressea.tests.spells'
require 'eressea.tests.common'
require 'eressea.tests.stealth'
-- require 'eressea.tests.spells-e3'
-- require 'eressea.tests.spells-e2'
require 'eressea.tests.settings'
-- require 'eressea.tests.morale'
-- require 'eressea.tests.orders'
-- require 'eressea.tests.eressea'
-- require 'eressea.tests.e3a'
-- require 'eressea.tests.config'
-- require 'eressea.tests.common'
require 'eressea.tests.castles'
require 'eressea.tests.bindings'
-- require 'eressea.tests.bson'
-- require 'eressea.tests.attrib'

View File

@ -1,179 +0,0 @@
require "lunit"
module("tests.eressea.morale", package.seeall, lunit.testcase )
function setup()
eressea.game.reset()
eressea.settings.set('rules.region_owners', '1')
end
function test_when_owner_returns_morale_drops_only_2()
local r = region.create(0, 0, "plain")
assert_equal(1, r.morale)
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
u1:add_item("money", 10000)
local b = building.create(r, "castle")
b.size = 50
set_turn(get_turn()+10)
f1.lastturn=get_turn()
u1.building = b
update_owners()
r.morale = 6
u1.building = nil
process_orders()
assert_equal(5, r.morale) -- no owner, fall by 1
u1.building = b
update_owners()
set_key("test", 42)
process_orders()
assert_equal(3, r.morale) -- new owner, fall by 2
end
function test_morale_alliance()
local r = region.create(0, 0, "plain")
assert_equal(1, r.morale)
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
u1:add_item("money", 10000)
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u2 = unit.create(f2, r, 1)
u2:add_item("money", 10000)
local f3 = faction.create("noreply@eressea.de", "human", "de")
local u3 = unit.create(f3, r, 1)
u3:add_item("money", 10000)
local al = alliance.create(42, "Die Antwoord")
f1.alliance = al;
f2.alliance = al;
local b = building.create(r, "castle")
b.size = 50
u1.building = b
u2.building = b
u3.building = b
update_owners()
r.morale = 6
local function run_a_turn()
process_orders()
f1.lastturn=get_turn()
f2.lastturn=get_turn()
f3.lastturn=get_turn()
end
-- just checking everything's okay after setup.
run_a_turn()
assert_equal(6, r.morale)
-- change owner, new owner is in the same alliance
u1.building = nil
run_a_turn()
assert_equal(4, r.morale)
-- change owner, new owner is not in the same alliance
u2.building = nil
run_a_turn()
assert_equal(0, r.morale)
end
function test_morale_change()
local r = region.create(0, 0, "plain")
assert_equal(1, r.morale)
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
u1:add_item("money", 10000)
local f2 = faction.create("noreply@eressea.de", "human", "de")
local u2 = unit.create(f2, r, 1)
u2:add_item("money", 10000)
local AVG_STEP = 6
local b = building.create(r, "castle")
b.size = 10
u1.building = b
local function run_a_turn()
process_orders()
f1.lastturn=get_turn()
f2.lastturn=get_turn()
end
-- reinhardt-regel: nach 2*AVG_STEP ist moral mindestens einmal gestiegen.
update_owners()
assert_not_equal(r.owner, nil)
for i=1,AVG_STEP*2 do
run_a_turn()
assert_not_equal(r.owner, nil)
end
assert_not_equal(1, r.morale)
-- regel: moral ist nie hoeher als 2 punkte ueber burgen-max.
for i=1,AVG_STEP*4 do
run_a_turn()
end
assert_equal(4, r.morale)
-- auch mit herrscher faellt moral um 1 pro woche, wenn moral > burgstufe
r.morale = 6
run_a_turn()
assert_equal(5, r.morale)
run_a_turn()
assert_equal(4, r.morale)
run_a_turn()
assert_equal(4, r.morale)
-- regel: ohne herrscher fällt die moral jede woche um 1 punkt, bis sie 1 erreicht
u1.building = nil
update_owners()
run_a_turn()
assert_equal(3, r.morale)
run_a_turn()
assert_equal(2, r.morale)
run_a_turn()
assert_equal(1, r.morale)
run_a_turn()
assert_equal(1, r.morale)
-- ohne herrscher ändert sich auch beschissene Moral nicht:
r.morale = 0
run_a_turn()
assert_equal(0, r.morale)
end
function test_morale_old()
local r = region.create(0, 0, "plain")
assert_equal(1, r.morale)
local f1 = faction.create("first@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 1)
local f2 = faction.create("second@eressea.de", "human", "de")
local u2 = unit.create(f2, r, 1)
local b = building.create(r, "castle")
b.size = 10
u1.building = b
u2.building = b
update_owners()
assert_equal(1, r.morale)
r.morale = 5
assert_equal(u1.faction, r.owner)
u1:clear_orders()
u1:add_order("GIB " .. itoa36(u2.id) .. " KOMMANDO")
process_orders()
u1:clear_orders()
assert_equal(r.owner, u2.faction)
assert_equal(3, r.morale) -- 5-MORALE_TRANSFER
for u in r.units do
if u.faction.id==u2.faction.id then
u.building = nil
end
end
update_owners()
assert_equal(r.owner, u1.faction)
assert_equal(0, r.morale)
end
function test_no_uruk()
local f1 = faction.create("noreply@eressea.de", "uruk", "de")
assert_equal(f1.race, "orc")
end

View File

@ -1,13 +0,0 @@
require "lunit"
module("tests.eressea.settings", package.seeall, lunit.testcase )
function setup()
eressea.free_game()
end
function test_settings()
assert_equal(nil, eressea.settings.get("foo"))
eressea.settings.set("foo", "bar")
assert_equal("bar", eressea.settings.get("foo"))
end

View File

@ -1,47 +0,0 @@
require "lunit"
module("eressea.tests.spells.e3", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.peasants.growth", "0")
end
function test_blessedharvest_lasts_n_turn()
eressea.free_game()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "halfling", "de")
local u = unit.create(f, r)
local err = 0
r:set_resource("peasant", 100)
r:set_resource("money", 0)
u:add_item("money", 1000)
u.magic = "gwyrrd"
u.race = "dwarf"
u:set_skill("magic", 20)
u.aura = 200
err = err + u:add_spell("raindance")
err = err + u:add_spell("blessedharvest")
assert_equal(0, err)
u:clear_orders()
u:add_order("ZAUBERE STUFE 3 Regentanz")
assert_equal(0, r:get_resource("money"), 0)
local m = 0
local p = 100
process_orders()
assert_equal(200, r:get_resource("money"))
u:clear_orders()
u:add_order("ARBEITEN")
process_orders()
process_orders()
process_orders()
assert_equal(800, r:get_resource("money"))
process_orders()
assert_equal(900, r:get_resource("money"))
end

30
scripts/fixfamiliars.lua Normal file
View File

@ -0,0 +1,30 @@
require 'config'
function write_fam(file)
for f in factions() do for u in f.units do if u.familiar then
file:write(u.id .. " " .. u.familiar.id .. "\n")
end end end
end
function read_fam(file)
m, f = file:read("*n", "*n")
while m and f do
mag = get_unit(m)
fam = get_unit(f)
if mag and fam then
mag.familiar = fam
end
m, f = file:read("*n", "*n")
end
end
eressea.read_game(get_turn()..".dat")
file = io.open("familiars.txt", "r")
if file then
read_fam(file)
eressea.write_game(get_turn()..".fix")
else
file = io.open("familiars.txt", "w")
write_fam(file)
end
file:close()

View File

@ -9,59 +9,22 @@ local function read_players()
local str = input:read("*line")
if str==nil then break end
local email, race, lang = str:match("([^ ]*) ([^ ]*) ([^ ]*)")
if string.char(string.byte(email, 1))~='#' then
table.insert(players, { race = race, lang = lang, email = email })
end
end
return players
end
local function seed(r, email, race, lang)
local f = faction.create(email, race, lang)
local u = unit.create(f, r)
u:set_skill("perception", 30)
u:add_item("money", 20000)
items = {
log = 50,
stone = 50,
iron = 50,
laen = 10,
mallorn = 10,
skillpotion = 5
}
for it, num in pairs(items) do
u:add_item(it, num)
end
u = nil
skills ={
"crossbow",
"bow",
"building",
"trade",
"forestry",
"catapult",
"herbalism",
"training",
"riding",
"armorer",
"shipcraft",
"melee",
"sailing",
"polearm",
"espionage",
"roadwork",
"tactics",
"stealth",
"weaponsmithing",
"cartmaking",
"taxation",
"stamina"
}
unit.create(f, r, 50):set_skill("entertainment", 15)
equip_unit(u, "new_faction")
equip_unit(u, "first_unit")
equip_unit(u, "first_" .. race, 7) -- disable old callbacks
unit.create(f, r, 5):set_skill("mining", 30)
unit.create(f, r, 5):set_skill("quarrying", 30)
for _, sk in ipairs(skills) do
u = u or unit.create(f, r, 5)
if u:set_skill(sk, 15)>0 then u=nil end
end
f:set_origin(r)
return f
end
@ -80,12 +43,13 @@ local function dump_selection(sel)
end
players = read_players()
local limit = 30000
local peasants = 20000
local trees = 1000
local turn = get_turn()
local sel
if #players > 0 then
eressea.read_game(("%d.dat"):format(turn))
sel = p.select(regions(), limit)
sel = p.select(regions(), peasants, trees)
if #sel > 0 then
local best = dump_selection(sel)
print("finest region, " .. best.score .. " points: " .. tostring(best.r))
@ -94,12 +58,17 @@ end
math.randomseed(os.time())
local newbs = {}
for _, p in ipairs(players) do
local index = math.random(#sel)
local per_region = 2
local num_seeded = 2
local start = nil
for _, p in ipairs(players) do
if num_seeded == per_region then
while not start or start.units() do
local index = math.random(#sel)
start = sel[index]
end
num_seeded = 0
end
local dupe = false
for f in factions() do
if f.email==p.email then
@ -109,6 +78,7 @@ for _, p in ipairs(players) do
end
end
if not dupe then
num_seeded = num_seeded + 1
f = seed(start, p.email, p.race or "human", p.lang or "de")
print("new faction ".. tostring(f) .. " starts in ".. tostring(start))
table.insert(newbs, f)

View File

@ -6,19 +6,18 @@ local function score(r, res)
local x, y, rn
local peas = r:get_resource(res)
for _, rn in pairs(r.adj) do
if rn then
if rn and not rn.units() then
peas = peas + rn:get_resource(res)
end
end
return peas
end
local function select(regions, limit)
local function select(regions, peasants, trees)
local sel = {}
for r in regions do
if r.terrain~="ocean" and r.units()==nil then
s = score(r)
if s >= limit then
if not r.plane and r.terrain~="ocean" and not r.units() then
if score(r, "peasant") >= peasants and score(r, "tree") >= trees then
table.insert(sel, r)
end
end

View File

@ -15,6 +15,7 @@ require 'eressea'
require 'eressea.xmlconf'
require 'eressea.path'
require 'tests.e2'
require 'tests.xmas'
require 'lunit'
rules = require('eressea.' .. config.rules)

View File

@ -15,6 +15,7 @@ require 'eressea'
require 'eressea.path'
require 'eressea.xmlconf'
require 'tests.e3'
require 'tests.xmas'
require 'lunit'
eressea.settings.set("rules.alliances", "0")

23
scripts/run-tests-e4.lua Normal file
View File

@ -0,0 +1,23 @@
-- Tests that work in E3. With game config of E3.
-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua
path = 'scripts'
if config.install then
path = config.install .. '/' .. path
package.path = package.path .. ';' .. config.install .. '/lunit/?.lua'
--needed to find lunit if not run form eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder)
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
config.rules = 'e4'
require 'eressea'
require 'eressea.path'
require 'eressea.xmlconf'
require 'tests.e3'
require 'lunit'
eressea.settings.set("rules.alliances", "0")
rules = require('eressea.' .. config.rules)
result = lunit.main()
return result.errors + result.failed

View File

@ -22,16 +22,16 @@ local function two_factions()
return f1, f2
end
module("tests.eressea.common", package.seeall, lunit.testcase)
module("tests.common", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.peasants.growth", "1")
eressea.settings.set("study.random_progress", "0")
end
function test_flags()
@ -39,13 +39,13 @@ function test_flags()
local f = faction.create("flags@eressea.de", "halfling", "de")
local u = unit.create(f, r, 1)
local no = itoa36(f.id)
local flags = 587203585
local flags = 50332673
f.flags = flags
eressea.write_game("test.dat")
eressea.free_game()
eressea.read_game("test.dat")
os.remove('test.dat')
os.remove('data/test.dat')
f = get_faction(no)
assert_equal(flags, f.flags)
end
@ -92,7 +92,7 @@ function test_demon_food()
local u = unit.create(f, r, 1)
local p = r:get_resource("peasant")
r:set_resource("peasant", 2000)
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.food.flags", "0")
eressea.settings.set("rules.peasants.growth", "0")
process_orders()
assert_not_nil(u)
@ -194,6 +194,7 @@ function test_descriptions()
eressea.write_game(filename)
eressea.free_game()
eressea.read_game(filename)
os.remove("data/test.dat")
assert_equal(info, get_ship(sno).info)
assert_equal(info, get_unit(uno).info)
assert_equal(info, get_faction(fno).info)
@ -459,7 +460,7 @@ function test_work()
end
function test_upkeep()
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.food.flags", "0")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply10@eressea.de", "human", "de")
local u = unit.create(f, r, 5)
@ -601,30 +602,6 @@ function test_control()
assert_equal(u2, b.owner)
end
function test_store_unit()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply15@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local fid = f.id
u:add_item("money", u.number * 100)
local filename = config.basepath .. "/data/test.dat"
store = storage.create(filename, "wb")
assert_not_equal(store, nil)
store:write_unit(u)
store:close()
eressea.free_game()
-- recreate world:
r = region.create(0, 0, "plain")
f = faction.create("noreply16@eressea.de", "human", "de")
f.id = fid
store = storage.create(filename, "rb")
assert_not_nil(store)
u = store:read_unit()
store:close()
assert(u)
assert(u:get_item("money") == u.number * 100)
end
function test_building_other()
local r = region.create(0,0, "plain")
local f1 = faction.create("noreply17@eressea.de", "human", "de")
@ -645,6 +622,8 @@ function test_building_other()
assert_not_equal(10, b.size)
end
-- segfault above
function test_config()
assert_not_equal(nil, config.basepath)
assert_not_equal(nil, config.locales)
@ -790,6 +769,7 @@ function test_expensive_skills_cost_money()
u:add_item("money", 10000)
u:clear_orders()
u:add_order("LERNEN MAGIE Gwyrrd")
assert_equal(0, u:get_skill("magic"))
process_orders()
assert_equal(9900, u:get_item("money"))
assert_equal(1, u:get_skill("magic"))
@ -802,7 +782,7 @@ function test_food_is_consumed()
u:add_item("money", 100)
u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
process_orders()
assert_equal(100, u:get_item("money"))
end
@ -814,7 +794,7 @@ function test_food_can_override()
u:add_item("money", 100)
u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.food.flags", "0")
process_orders()
assert_equal(90, u:get_item("money"))
end
@ -941,7 +921,7 @@ module("tests.recruit", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.peasants.growth", "0")
end
@ -981,9 +961,8 @@ module("tests.report", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
end
local function find_in_report(f, pattern, extension)
@ -995,7 +974,6 @@ local function find_in_report(f, pattern, extension)
report:close()
local start, _ = string.find(t, pattern)
-- posix.unlink(filename)
return start~=nil
end
@ -1052,6 +1030,7 @@ function test_coordinates_noname_plane()
end
function test_lighthouse()
eressea.free_game()
local r = region.create(0, 0, "mountain")
local f = faction.create("noreply@eressea.de", "human", "de")
region.create(1, 0, "mountain")
@ -1083,7 +1062,7 @@ module("tests.parser", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("rules.economy.food", "4") -- FOOD_IS_FREE
eressea.settings.set("rules.food.flags", "4") -- FOOD_IS_FREE
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.move.owner_leave", "0")
end
@ -1092,7 +1071,7 @@ function test_parser()
local r = region.create(0, 0, "mountain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local filename = config.basepath .. "/data/orders.txt"
local filename = "orders.txt"
local file = io.open(filename, "w")
assert_not_nil(file)
@ -1103,5 +1082,38 @@ function test_parser()
eressea.read_orders(filename)
process_orders()
os.remove(filename)
assert_equal("Goldene Herde", u.name)
end
local function set_order(u, str)
u:clear_orders()
u:add_order(str)
end
function test_prefix()
local r0 = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f1, r0, 1)
set_order(u1, "PRAEFIX See")
process_orders()
assert_not_nil(u1:show():find("Seemensch"))
u1.race = "elf"
assert_not_nil(u1:show():find("Seeelf"))
set_order(u1, "PRAEFIX Mond")
process_orders()
assert_not_nil(u1:show():find("Mondelf"))
set_order(u1, "PRAEFIX")
process_orders()
assert_not_nil(u1:show():find("Elf"))
set_order(u1, "PRAEFIX Erz")
process_orders()
assert_not_nil(u1:show():find("Erzelf"))
u1.faction.locale = "en"
assert_not_nil(u1:show():find("archelf"))
end

View File

@ -36,4 +36,3 @@ function test_read_ship()
s = ship.create(nil, "boat")
assert_not_nil(s)
end

View File

@ -0,0 +1,49 @@
require "lunit"
module("tests.e2.destroy", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("NewbieImmunity", "0")
end
function disabled_test_dont_move_after_destroy()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u = unit.create(f, r1, 1)
u.building = building.create(u.region, "castle")
u:clear_orders()
u:add_order("NACH O")
u:add_order("ZERSTOERE " .. itoa36(u.building.id))
process_orders()
if not u.region then
print("shit happened ", u.number)
end
assert_equal(r1, u.region)
assert_equal(nil, u.building)
end
function test_dont_destroy_after_attack()
local r1 = region.create(0, 0, "plain")
local u = unit.create(faction.create("one@example.com", "human", "de"), r1, 10)
local u2 = unit.create(faction.create("two@example.com", "human", "de"), r1, 1)
u.building = building.create(u.region, "castle")
u:clear_orders()
u:add_order("ATTACKIERE " .. itoa36(u2.id))
u:add_order("ZERSTOERE " .. itoa36(u.building.id))
process_orders()
assert_not_nil(u.building)
end
function test_destroy_is_long()
local r1 = region.create(0, 0, "plain")
local u = unit.create(faction.create("one@example.com", "human", "de"), r1, 10)
u.building = building.create(u.region, "castle")
u:clear_orders()
u:add_order("LERNE Unterhaltung")
u:add_order("ZERSTOERE " .. itoa36(u.building.id))
process_orders()
assert_equal(0, u:get_skill("entertainment"))
assert_equal(nil, u.building)
end

View File

@ -22,7 +22,8 @@ end
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.storms", "0")
end
function test_learn()
@ -107,7 +108,7 @@ function test_ship_capacity()
local r = region.create(0,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("capacity@eressea.de", "human", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "boat")

View File

@ -4,10 +4,9 @@ module("tests.e2.guard", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
end
function test_guard_unarmed()

View File

@ -1,4 +1,13 @@
require 'tests.e2.undead'
require 'tests.e2.shiplanding'
require 'tests.e2.e2features'
require 'tests.e2.movement'
require 'tests.e2.destroy'
require 'tests.e2.guard'
require 'tests.e2.spells'
require 'tests.e2.stealth'
require 'tests.orders'
require 'tests.common'
require 'tests.storage'
require 'tests.magicbag'
require 'tests.process'

View File

@ -4,7 +4,6 @@ module("tests.e2.movement", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
end

View File

@ -4,7 +4,6 @@ module("tests.e2.shiplanding", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
end

View File

@ -0,0 +1,42 @@
require "lunit"
module("tests.e2.ships", package.seeall, lunit.testcase)
function setup()
eressea.settings.set("rules.ship.damage.nocrewocean", "0")
eressea.settings.set("rules.ship.damage.nocrew", "0")
eressea.settings.set("rules.ship.drifting", "0")
end
function test_ship_requires_skill()
local r1 = region.create(0, 0, "ocean")
local r2 = region.create(1, 0, "ocean")
local f = faction.create("fake@eressea.de", "human", "de")
local u1 = unit.create(f, r1, 1)
u1.name = "fake"
u1.ship = ship.create(r1, "longboat")
u1:clear_orders()
u1:add_order("NACH O")
process_orders()
assert_equal(r1, u1.ship.region)
assert_equal(r1, u1.region)
end
function no_test_ship_happy_case()
local r1 = region.create(0, 0, "ocean")
local r2 = region.create(1, 0, "ocean")
local f = faction.create("hodor@eressea.de", "human", "de")
local u1 = unit.create(f, r1, 1)
local u2 = unit.create(f, r1, 1)
u1.ship = ship.create(r1, "longboat")
u2.ship = u1.ship
u1:clear_orders()
u1:add_order("NACH O")
u1:set_skill("sailing", 1) -- cptskill = 1
u2:set_skill("sailing", 9) -- sumskill = 10
process_orders()
assert_equal(r2, u1.ship.region)
assert_equal(r2, u1.region)
assert_equal(r2, u2.region)
end

View File

@ -0,0 +1,28 @@
require "lunit"
module("tests.e2.spells", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.food.flags", "4")
end
function test_shapeshift()
local r = region.create(42, 0, "plain")
local f = faction.create("noreply@eressea.de", "demon", "de")
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u1:clear_orders()
u1.magic = "gray"
u1:set_skill("magic", 2)
u1.aura = 1
u1:add_spell("shapeshift")
u1:add_order("ZAUBERE STUFE 1 Gestaltwandlung " .. itoa36(u2.id) .. " Goblin")
process_orders()
assert_equal(f.race, u2.race)
s = u2:show()
assert_equal("1 Goblin", string.sub(s, string.find(s, "1 Goblin")))
end

View File

@ -1,11 +1,11 @@
require "lunit"
module('eressea.tests.stealth', package.seeall, lunit.testcase)
module('tests.e2.stealth', package.seeall, lunit.testcase)
local f
local u
local settings
local settings = {}
local function set_rule(key, value)
if value==nil then
@ -18,7 +18,7 @@ end
function setup()
eressea.game.reset()
set_rule('rules.economy.food', '4')
set_rule('rules.food.flags', '4')
set_rule('rules.magic.playerschools', '')
local r = region.create(0,0, "plain")
@ -28,7 +28,7 @@ function setup()
end
function teardown()
set_rule('rules.economy.food')
set_rule('rules.food.flags')
set_rule('rules.magic.playerschools')
set_rule('rules.stealth.faction')
end

View File

@ -0,0 +1,31 @@
require "lunit"
module("tests.e2.undead", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
end
function test_undead_give_item()
local r1 = region.create(0, 0, "plain")
local f1 = faction.create("hodor@eressea.de", "human", "de")
local u1 = unit.create(f1, r1, 1)
u1.race = "undead"
u1:clear_orders()
u1:add_item("log", 1)
u1:add_order("GIB 0 1 Holz")
process_orders()
assert_equal(0, u1:get_item("log"))
end
function test_undead_dont_give_person()
local r1 = region.create(0, 0, "plain")
local f1 = faction.create("hodor@eressea.de", "human", "de")
local u1 = unit.create(f1, r1, 2)
u1.race = "undead"
u1:clear_orders()
u1:add_item("log", 1)
u1:add_order("GIB 0 1 Person")
process_orders()
assert_equal(2, u1.number)
end

View File

@ -25,3 +25,28 @@ function test_small_castles()
assert_equal("site", b:get_typename(9))
assert_equal("fortification", b:get_typename(10))
end
function test_build_normal()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:clear_orders()
u:add_item("stone", 10)
u:set_skill("building", 10)
u:add_order("MACHE BURG")
process_orders()
assert_not_nil(u.building)
assert_equal(10, u.building.size)
end
function test_build_packice()
local r = region.create(0, 0, "packice")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:clear_orders()
u:add_item("stone", 10)
u:set_skill("building", 10)
u:add_order("MACHE BURG")
process_orders()
assert_equal(nil, u.building)
end

View File

@ -3,3 +3,8 @@ require 'tests.e3.stealth'
require 'tests.e3.spells'
require 'tests.e3.rules'
require 'tests.e3.parser'
require 'tests.e3.morale'
require 'tests.orders'
require 'tests.common'
require 'tests.magicbag'
require 'tests.process'

View File

@ -3,7 +3,7 @@ require "lunit"
module("tests.e3.morale", package.seeall, lunit.testcase )
function setup()
eressea.free_game()
eressea.game.reset()
end
function test_when_owner_returns_morale_drops_only_2()

View File

@ -17,14 +17,14 @@ function setup()
eressea.game.reset()
settings = {}
set_rule("rules.move.owner_leave", "1")
set_rule("rules.economy.food", "4")
set_rule("rules.food.flags", "4")
set_rule("rules.ship.drifting", "0")
set_rule("rules.ship.storms", "0")
end
function teardown()
set_rule("rules.move.owner_leave")
set_rule("rules.economy.food")
set_rule("rules.food.flags")
set_rule("rules.ship.drifting")
set_rule("rules.ship.storms")
end
@ -76,9 +76,7 @@ function disable_test_market_action()
b.size = 10
u.building = b
update_owners()
for r in regions() do
market_action(r)
end
process.markets()
assert_equal(35, u:get_item("balm"))
assert_equal(70, u:get_item("h2"))
end
@ -148,24 +146,20 @@ function test_no_stealth()
assert_equal(-1, u:get_skill("stealth"))
end
--[[
function test_analyze_magic()
local r1 = region.create(0,0, "plain")
local r2 = region.create(1,0, "plain")
function test_no_teach()
local r = region.create(0,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
local u = unit.create(f, r2, 1)
u.race = "elf"
u:set_skill("magic", 6)
u.magic = "gwyrrd"
u.aura = 60
u:add_spell("analyze_magic")
u:clear_orders()
u:add_order("Zaubere stufe 2 'Magie analysieren' REGION 1,0")
u1:clear_orders()
u2:clear_orders()
u1:set_skill("riding", 3)
u2:add_order("LERNE Reiten")
u1:add_order("LEHRE " .. itoa36(u2.id))
process_orders()
-- TODO: assert something (reflecting skills sucks!)
end
]]--
function test_seecast()
local r = region.create(0,0, "plain")
@ -205,29 +199,8 @@ function test_seecast()
assert_equal(8, u2.region.x)
end
local function use_tree(terrain)
local r = region.create(0,0, terrain)
local f = faction.create("noreply@eressea.de", "human", "de")
local u1 = unit.create(f, r, 5)
r:set_resource("tree", 0)
u1:add_item("xmastree", 1)
u1:clear_orders()
u1:add_order("BENUTZEN 1 Weihnachtsbaum")
process_orders()
return r
end
function test_xmastree()
local r
r = use_tree("ocean")
assert_equal(0, r:get_resource("tree"))
eressea.free_game()
r = use_tree("plain")
assert_equal(10, r:get_resource("tree"))
end
function test_fishing()
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.food.flags", "0")
local r = region.create(0,0, "ocean")
local r2 = region.create(1,0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
@ -481,7 +454,6 @@ function test_canoe_passes_through_land()
u1:add_order("NACH O O O")
process_orders()
assert_equal(land, u2.region, "canoe did not stop at coast")
u1:add_order("NACH O O O")
process_orders()
assert_equal(dst, sh.region, "canoe could not leave coast")
assert_equal(dst, u1.region, "canoe could not leave coast")

View File

@ -8,7 +8,7 @@ function setup()
eressea.free_game()
eressea.settings.set("magic.regeneration.enable", "0")
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
r = region.create(0, 0, "plain")
f = faction.create("spell_payment@eressea.de", "elf", "de")

View File

@ -5,7 +5,6 @@ module("tests.e3.spells", package.seeall, lunit.testcase)
function setup()
eressea.game.reset()
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.peasants.growth", "0")
end
@ -59,7 +58,6 @@ function test_magic()
u:add_spell("protective_runes")
u:add_spell("analyze_magic")
u:clear_orders()
u:add_order("ZAUBERE \"Runen des Schutzes\" BURG " .. itoa36(b.id));
u.building = b
u:add_order("ZAUBERE \"Magie analysieren\" BURG " .. itoa36(b.id));
process_orders()

View File

@ -7,7 +7,7 @@ local u
function setup()
eressea.game.reset()
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.food.flags", "4")
local r = region.create(0,0, "plain")
f = faction.create("stealth1@eressea.de", "human", "de")

View File

@ -7,3 +7,5 @@ require 'tests.pool'
require 'tests.regions'
require 'tests.settings'
require 'tests.study'
require 'tests.laws'
require 'tests.bindings'

114
scripts/tests/laws.lua Normal file
View File

@ -0,0 +1,114 @@
require "lunit"
module("tests.laws", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
conf = [[{
"races": {
"human" : {}
},
"terrains" : {
"plain": { "flags" : [ "land", "walk", "sail" ] }
},
"keywords" : {
"de": {
"attack" : "ATTACKIERE",
"maketemp" : "MACHETEMP",
"end" : "ENDE",
"recruit" : "REKRUTIERE"
}
},
"buildings" : {
"castle" : {}
}
}]]
eressea.config.reset()
eressea.config.parse(conf)
end
function test_force_leave_on()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de")
local f2 = faction.create("guest@eressea.de")
local u1 = unit.create(f1, r, 1)
local u2 = unit.create(f2, r, 1)
local b1 = building.create(r, "castle")
u1.building = b1
u2.building = b1
eressea.settings.set("rules.owners.force_leave", "2")
process_orders()
assert_equal(b1, u1.building)
assert_equal(nil, u2.building)
end
function test_force_leave_off()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de")
local f2 = faction.create("guest@eressea.de")
local u1 = unit.create(f1, r, 1)
local u2 = unit.create(f2, r, 1)
local b1 = building.create(r, "castle")
u1.building = b1
u2.building = b1
eressea.settings.set("rules.owners.force_leave", "0")
process_orders()
assert_equal(b1, u1.building)
assert_equal(b1, u2.building)
end
function test_make_temp()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 10)
local u, u2
u1.building = building.create(r, "castle")
u1.status = 1
u1:clear_orders()
u1:add_order("MACHETEMP 1 Hodor")
u1:add_order("REKRUTIERE 1")
u1:add_order("ENDE")
process_orders()
for u in r.units do
if u~=u1 then
u2 = u
break
end
end
assert_not_equal(nil, u2)
assert_not_equal(nil, u2.building)
assert_equal(1, u2.number)
assert_equal(1, u2.status)
assert_equal("Hodor", u2.name)
end
function test_force_leave_postcombat()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de", "human", "de")
local f2 = faction.create("guest@eressea.de", "human", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
local u, u3
local b1 = building.create(r, "castle")
u1.building = b1
u2.building = b1
eressea.settings.set("rules.owners.force_leave", "1")
u1:clear_orders()
u1:add_order("ATTACKIERE " .. itoa36(u2.id))
u2:clear_orders()
u2:add_order("MACHETEMP 2 Hodor")
u2:add_order("REKRUTIERE 1")
u2:add_order("ENDE")
process_orders()
for u in r.units do
if u~=u1 and u~=u2 then
u3 = u
break
end
end
assert_not_equal(nil, u3)
assert_equal(nil, u3.building)
assert_equal(1, u3.number)
end

Some files were not shown because too many files have changed in this diff Show More