transfer most core and all game-specific terrains for E2 from XML to JSON.

This commit is contained in:
Enno Rehling 2015-09-11 21:14:10 +02:00
parent 16467dbafa
commit db4cb2618b
5 changed files with 99 additions and 54 deletions

View File

@ -1,7 +1,7 @@
{
"include": [
"keywords.json",
"terrains.json"
"e2/terrains.json"
],
"settings": {
"game.id": 2,

View File

@ -21,7 +21,6 @@
<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"/>

View File

@ -85,6 +85,99 @@
}
}
},
"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"
}
}
},
"hell": {
"flags": [ "land", "walk" ]
},
"hall1": {
"flags": [ "land", "walk", "sail" ]
},
"corridor1": {
"flags": [ "land", "walk", "sail" ]
},
"wall1": {
"flags": [ "forbidden" ]
},
"default": {
"size": 0,
"herbs": [],

View File

@ -1,58 +1,6 @@
<?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" />

View File

@ -282,6 +282,10 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
else if (strcmp(child->string, "seed") == 0) {
ter->distribution = (short)child->valueint;
}
else {
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
}
break;
default:
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
}
@ -829,6 +833,7 @@ void json_config(cJSON *json) {
}
else if (strcmp(child->string, "terrains") == 0) {
json_terrains(child);
init_terrains();
}
else {
log_error("config contains unknown attribute %s", child->string);