New code:

"equipment-sets" in the XML definition files (equipment.xml) can define skills and items for a unit. these can be applied using the equip_unit() function (from both LUA and C).

I've rewritten the random first encounters and addplayer() functions to use these. As a result, there's now even less dependency on fixed item types in the source, and I can take more items out.
This commit is contained in:
Enno Rehling 2005-10-02 20:28:44 +00:00
parent 5358c876d2
commit 49bd595d69
12 changed files with 310 additions and 249 deletions

View File

@ -18,7 +18,7 @@
/* tweakable features */ /* tweakable features */
#define ENCODE_SPECIAL 1 #define ENCODE_SPECIAL 1
#define RENDER_CRMESSAGES 1 #define RENDER_CRMESSAGES
/* modules include */ /* modules include */
#include <modules/score.h> #include <modules/score.h>
@ -477,7 +477,7 @@ render_messages(FILE * F, faction * f, message_list *msgs)
boolean printed = false; boolean printed = false;
const struct message_type * mtype = m->msg->type; const struct message_type * mtype = m->msg->type;
unsigned int hash = hashstring(mtype->name); unsigned int hash = hashstring(mtype->name);
#if RENDER_CRMESSAGES #ifdef RENDER_CRMESSAGES
char nrbuffer[1024*32]; char nrbuffer[1024*32];
nrbuffer[0] = '\0'; nrbuffer[0] = '\0';
if (nr_render(m->msg, f->locale, nrbuffer, sizeof(nrbuffer), f)>0 && nrbuffer[0]) { if (nr_render(m->msg, f->locale, nrbuffer, sizeof(nrbuffer), f)>0 && nrbuffer[0]) {

View File

@ -32,6 +32,7 @@
#include <kernel/battle.h> #include <kernel/battle.h>
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/curse.h> #include <kernel/curse.h>
#include <kernel/equipment.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/karma.h> #include <kernel/karma.h>
@ -339,33 +340,7 @@ get_allies(region * r, unit * u)
return; return;
newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race);
set_string(&newunit->name, "Söldner"); set_string(&newunit->name, "Söldner");
set_money(newunit, (rand() % 80 + 20) * newunit->number); equip_unit(newunit, get_equipment("random_plain"));
switch (rand() % 4) {
case 0:
set_level(newunit, SK_MELEE, 1+rand()%3);
set_item(newunit, I_SWORD, newunit->number);
break;
case 1:
set_level(newunit, SK_SPEAR, 1+rand()%3);
set_item(newunit, I_SPEAR, newunit->number);
break;
case 2:
set_level(newunit, SK_CROSSBOW, 1+rand()%3);
set_item(newunit, I_CROSSBOW, newunit->number);
break;
case 3:
set_level(newunit, SK_LONGBOW, 1+rand()%3);
set_item(newunit, I_LONGBOW, newunit->number);
break;
}
if (rand() % 100 < 40) {
set_item(newunit, I_CHAIN_MAIL, rand() % (newunit->number + 1));
}
if (rand() % 100 < 30) {
set_item(newunit, I_HORSE, newunit->number);
set_level(newunit, SK_RIDING, 1+rand()%3);
}
break; break;
} else { } else {
if (eff_skill(u, SK_LONGBOW, r) < 3 if (eff_skill(u, SK_LONGBOW, r) < 3
@ -375,14 +350,7 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Waldbewohner"); set_string(&newunit->name, "Waldbewohner");
set_money(newunit, (rand() % 20 + 10) * newunit->number); equip_unit(newunit, get_equipment("random_forest"));
set_level(newunit, SK_LONGBOW, 2+rand()%3);
set_item(newunit, I_LONGBOW, newunit->number);
set_level(newunit, SK_OBSERVATION, 2+rand()%2);
set_level(newunit, SK_STEALTH, 1+rand()%2);
if (rand() % 100 < 20) {
set_level(newunit, SK_HERBALISM, 1+rand()%2);
}
} }
break; break;
@ -392,10 +360,7 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Sumpfbewohner"); set_string(&newunit->name, "Sumpfbewohner");
set_money(newunit, (rand() % 20 + 10) * newunit->number); equip_unit(newunit, get_equipment("random_swamp"));
set_level(newunit, SK_SPEAR, 2+rand()%3);
set_item(newunit, I_SPEAR, newunit->number);
set_level(newunit, SK_STEALTH, 2+rand()%3);
break; break;
case T_DESERT: case T_DESERT:
@ -404,13 +369,7 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 12 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 12 + 2, u->faction->race);
set_string(&newunit->name, "Berber"); set_string(&newunit->name, "Berber");
set_money(newunit, (rand() % 30 + 20) * newunit->number); equip_unit(newunit, get_equipment("random_desert"));
set_level(newunit, SK_MELEE, 1+rand()%2);
set_item(newunit, I_SWORD, newunit->number);
set_level(newunit, SK_TRADE, 1+rand()%3);
set_level(newunit, SK_RIDING, 2+rand()%2);
set_item(newunit, I_HORSE, newunit->number);
set_level(newunit, SK_HORSE_TRAINING, 2+rand()%2);
break; break;
case T_HIGHLAND: case T_HIGHLAND:
@ -419,9 +378,7 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 8 + 2, u->faction->race);
set_string(&newunit->name, "Hochlandbarbaren"); set_string(&newunit->name, "Hochlandbarbaren");
set_money(newunit, (rand() % 10 + 20) * newunit->number); equip_unit(newunit, get_equipment("random_highland"));
set_level(newunit, SK_MELEE, 1+rand()%2);
set_item(newunit, I_SWORD, newunit->number);
break; break;
case T_MOUNTAIN: case T_MOUNTAIN:
@ -431,14 +388,8 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 6 + 2, u->faction->race);
set_string(&newunit->name, "Bergbewohner"); set_string(&newunit->name, "Bergbewohner");
set_money(newunit, (rand() % 40 + 60) * newunit->number); equip_unit(newunit, get_equipment("random_mountain"));
set_level(newunit, SK_MELEE, 2+rand()%2);
set_item(newunit, I_SWORD, newunit->number);
set_level(newunit, SK_ARMORER, 2+rand()%2);
set_level(newunit, SK_TRADE, 1+rand()%3);
if (rand() % 100 < 60) {
set_item(newunit, I_PLATE_ARMOR, newunit->number);
}
break; break;
case T_GLACIER: case T_GLACIER:
@ -448,10 +399,8 @@ get_allies(region * r, unit * u)
} }
newunit = createunit(r, u->faction, rand() % 4 + 2, u->faction->race); newunit = createunit(r, u->faction, rand() % 4 + 2, u->faction->race);
set_string(&newunit->name, "Eisleute"); set_string(&newunit->name, "Eisleute");
set_money(newunit, (rand() % 20 + 20) * newunit->number); equip_unit(newunit, get_equipment("random_glacier"));
set_level(newunit, SK_MELEE, 2+rand()%2);
set_item(newunit, I_SWORD, newunit->number);
set_level(newunit, SK_ARMORER, 2+rand()%2);
break; break;
} }

View File

@ -15,6 +15,8 @@
#include <config.h> #include <config.h>
#include "eressea.h" #include "eressea.h"
#include "faction.h" #include "faction.h"
#include "equipment.h"
#include "unit.h" #include "unit.h"
#include "race.h" #include "race.h"
#include "region.h" #include "region.h"
@ -142,7 +144,9 @@ addplayer(region *r, faction * f)
assert(f->units==NULL); assert(f->units==NULL);
set_ursprung(f, 0, r->x, r->y); set_ursprung(f, 0, r->x, r->y);
u = createunit(r, f, 1, f->race); u = createunit(r, f, 1, f->race);
give_starting_equipment(r, u); equip_unit(u, get_equipment("new_faction"));
equip_unit(u, get_equipment(u->race->_name[0]));
give_starting_equipment(u);
fset(u, UFL_ISNEW); fset(u, UFL_ISNEW);
if (f->race == new_race[RC_DAEMON]) { if (f->race == new_race[RC_DAEMON]) {
race_t urc; race_t urc;

View File

@ -178,6 +178,9 @@
<File <File
RelativePath=".\alchemy.h"> RelativePath=".\alchemy.h">
</File> </File>
<File
RelativePath=".\alliance.h">
</File>
<File <File
RelativePath=".\battle.h"> RelativePath=".\battle.h">
</File> </File>
@ -199,6 +202,9 @@
<File <File
RelativePath=".\curse.h"> RelativePath=".\curse.h">
</File> </File>
<File
RelativePath=".\equipment.h">
</File>
<File <File
RelativePath=".\eressea.h"> RelativePath=".\eressea.h">
</File> </File>
@ -299,9 +305,6 @@
<File <File
RelativePath=".\alliance.c"> RelativePath=".\alliance.c">
</File> </File>
<File
RelativePath=".\alliance.h">
</File>
<File <File
RelativePath=".\battle.c"> RelativePath=".\battle.c">
</File> </File>
@ -323,6 +326,9 @@
<File <File
RelativePath=".\curse.c"> RelativePath=".\curse.c">
</File> </File>
<File
RelativePath=".\equipment.c">
</File>
<File <File
RelativePath=".\eressea.c"> RelativePath=".\eressea.c">
</File> </File>

View File

@ -172,118 +172,6 @@ set_show_item(faction *f, item_t i)
a->data.v = (void*)olditemtype[i]; a->data.v = (void*)olditemtype[i];
} }
typedef struct equipment {
const struct race * rc;
item * items;
int skills[MAXSKILLS];
struct equipment * next;
} equipment;
static equipment * starting_equipment;
static equipment *
make_equipment(const struct race * rc)
{
equipment ** eqp = &starting_equipment;
while (*eqp) {
struct equipment * eq = *eqp;
if (eq->rc==rc) break;
eqp = &eq->next;
}
if (*eqp == NULL) {
struct equipment * eq = malloc(sizeof(equipment));
eq->rc = rc;
eq->next = NULL;
eq->items = NULL;
memset(eq->skills, 0, sizeof(eq->skills));
*eqp = eq;
} else {
struct equipment * eq = *eqp;
eq->rc = rc;
eq->items = NULL;
}
return *eqp;
}
void
startup_skill(skill_t sk, int value, const struct race * rc)
{
if (value>0) {
equipment * eq = make_equipment(rc);
eq->skills[sk] = value;
}
}
void
startup_equipment(const item_type * itype, int number, const struct race * rc)
{
if (itype!=NULL && number>0) {
equipment * eq = make_equipment(rc);
i_change(&eq->items, itype, number);
}
}
void
give_equipment(unit * u, const struct race * rc)
{
equipment * eq = starting_equipment;
while (eq && eq->rc!=rc) {
eq = eq->next;
}
if (eq) {
skill_t sk;
item * itm;
for (sk=0;sk!=MAXSKILLS;++sk) {
if (eq->skills[sk]>0) {
set_level(u, sk, eq->skills[sk]);
}
}
for (itm=eq->items;itm!=NULL;itm=itm->next) {
i_add(&u->items, i_new(itm->type, itm->number));
}
}
}
void
give_starting_equipment(struct region *r, struct unit *u)
{
give_equipment(u, NULL);
give_equipment(u, u->race);
switch(old_race(u->race)) {
case RC_ELF:
set_show_item(u->faction, I_FEENSTIEFEL);
break;
case RC_GOBLIN:
set_show_item(u->faction, I_RING_OF_INVISIBILITY);
scale_number(u, 10);
break;
case RC_HUMAN:
{
building *b = new_building(bt_find("castle"), r, u->faction->locale);
b->size = 10;
u->building = b;
fset(u, UFL_OWNER);
}
break;
case RC_CAT:
set_show_item(u->faction, I_RING_OF_INVISIBILITY);
break;
case RC_AQUARIAN:
{
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
sh->size = sh->type->construction->maxsize;
u->ship = sh;
fset(u, UFL_OWNER);
}
break;
case RC_CENTAUR:
rsethorses(r, 250+rand()%51+rand()%51);
break;
}
u->hp = unit_max_hp(u);
}
int int
unit_max_hp(const unit * u) unit_max_hp(const unit * u)
{ {
@ -312,6 +200,45 @@ unit_max_hp(const unit * u)
return h; return h;
} }
void
give_starting_equipment(struct unit *u)
{
struct region *r = u->region;
switch(old_race(u->race)) {
case RC_ELF:
set_show_item(u->faction, I_FEENSTIEFEL);
break;
case RC_GOBLIN:
set_show_item(u->faction, I_RING_OF_INVISIBILITY);
scale_number(u, 10);
break;
case RC_HUMAN:
{
building *b = new_building(bt_find("castle"), r, u->faction->locale);
b->size = 10;
u->building = b;
fset(u, UFL_OWNER);
}
break;
case RC_CAT:
set_show_item(u->faction, I_RING_OF_INVISIBILITY);
break;
case RC_AQUARIAN:
{
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
sh->size = sh->type->construction->maxsize;
u->ship = sh;
fset(u, UFL_OWNER);
}
break;
case RC_CENTAUR:
rsethorses(r, 250+rand()%51+rand()%51);
break;
}
u->hp = unit_max_hp(u);
}
boolean boolean
r_insectstalled(const region * r) r_insectstalled(const region * r)
{ {

View File

@ -181,9 +181,7 @@ extern int read_race_reference(const struct race ** rp, FILE * F);
extern const char * raceprefix(const struct unit *u); extern const char * raceprefix(const struct unit *u);
extern void startup_equipment(const struct item_type * itype, int number, const struct race * rc); extern void give_starting_equipment(struct unit *u);
extern void startup_skill(skill_t sk, int value, const struct race * rc);
extern void give_starting_equipment(struct region *r, struct unit *u);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -18,6 +18,7 @@ without prior permission by the authors of Eressea.
/* kernel includes */ /* kernel includes */
#include "building.h" #include "building.h"
#include "equipment.h"
#include "item.h" #include "item.h"
#include "message.h" #include "message.h"
#include "race.h" #include "race.h"
@ -869,9 +870,9 @@ parse_resources(xmlDocPtr doc)
} }
static void static void
add_items(xmlNodeSetPtr nsetItems, const race * rc) add_items(equipment * eq, xmlNodeSetPtr nsetItems)
{ {
if (nsetItems!=NULL) { if (nsetItems!=NULL && nsetItems->nodeNr>0) {
int i; int i;
for (i=0;i!=nsetItems->nodeNr;++i) { for (i=0;i!=nsetItems->nodeNr;++i) {
xmlNodePtr node = nsetItems->nodeTab[i]; xmlNodePtr node = nsetItems->nodeTab[i];
@ -883,22 +884,20 @@ add_items(xmlNodeSetPtr nsetItems, const race * rc)
itype = it_find((const char*)property); itype = it_find((const char*)property);
xmlFree(property); xmlFree(property);
if (itype!=NULL) { if (itype!=NULL) {
int num = 0;
property = xmlGetProp(node, BAD_CAST "amount"); property = xmlGetProp(node, BAD_CAST "amount");
if (property!=NULL) { if (property!=NULL) {
num = atoi((const char*)property); equipment_setitem(eq, itype, (const char*)property);
xmlFree(property); xmlFree(property);
} }
startup_equipment(itype, num, rc);
} }
} }
} }
} }
static void static void
add_skills(xmlNodeSetPtr nsetSkills, const race * rc) add_skills(equipment * eq, xmlNodeSetPtr nsetSkills)
{ {
if (nsetSkills!=NULL) { if (nsetSkills!=NULL && nsetSkills->nodeNr>0) {
int i; int i;
for (i=0;i!=nsetSkills->nodeNr;++i) { for (i=0;i!=nsetSkills->nodeNr;++i) {
xmlNodePtr node = nsetSkills->nodeTab[i]; xmlNodePtr node = nsetSkills->nodeTab[i];
@ -910,18 +909,73 @@ add_skills(xmlNodeSetPtr nsetSkills, const race * rc)
sk = sk_find((const char*)property); sk = sk_find((const char*)property);
xmlFree(property); xmlFree(property);
if (sk!=NOSKILL) { if (sk!=NOSKILL) {
int num = 0;
property = xmlGetProp(node, BAD_CAST "level"); property = xmlGetProp(node, BAD_CAST "level");
if (property!=NULL) { if (property!=NULL) {
num = atoi((const char*)property); equipment_setskill(eq, sk, (const char*)property);
xmlFree(property); xmlFree(property);
} }
startup_skill(sk, num, rc);
} }
} }
} }
} }
static void
add_subsets(xmlDocPtr doc, equipment * eq, xmlNodeSetPtr nsetSkills)
{
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
if (nsetSkills!=NULL && nsetSkills->nodeNr>0) {
int i;
eq->subsets = calloc(nsetSkills->nodeNr+1, sizeof(subset));
for (i=0;i!=nsetSkills->nodeNr;++i) {
xmlXPathObjectPtr xpathResult;
xmlNodePtr node = nsetSkills->nodeTab[i];
xmlChar * property;
eq->subsets[i].chance = 1.0f;
property = xmlGetProp(node, BAD_CAST "chance");
if (property!=NULL) {
eq->subsets[i].chance = (float)atof((const char *)property);
xmlFree(property);
}
xpath->node = node;
xpathResult = xmlXPathEvalExpression(BAD_CAST "set", xpath);
if (xpathResult->nodesetval) {
xmlNodeSetPtr nsetSets = xpathResult->nodesetval;
float totalChance = 0.0f;
if (nsetSets->nodeNr>0) {
int set;
eq->subsets[i].sets = calloc(nsetSets->nodeNr+1, sizeof(subsetitem));
for (set=0;set!=nsetSets->nodeNr;++set) {
xmlNodePtr nodeSet = nsetSets->nodeTab[set];
float chance = 1.0f;
property = xmlGetProp(nodeSet, BAD_CAST "chance");
if (property!=NULL) {
chance = (float)atof((const char *)property);
xmlFree(property);
}
totalChance += chance;
property = xmlGetProp(nodeSet, BAD_CAST "name");
assert(property!=NULL);
eq->subsets[i].sets[set].chance = chance;
eq->subsets[i].sets[set].set = create_equipment((const char*)property);
xmlFree(property);
}
}
if (totalChance>1.0f) {
log_error(("total chance exceeds 1.0: %f in equipment set %s.\n",
totalChance, eq->name));
}
}
xmlXPathFreeObject(xpathResult);
}
}
xmlXPathFreeContext(xpath);
}
static int static int
parse_equipment(xmlDocPtr doc) parse_equipment(xmlDocPtr doc)
{ {
@ -929,31 +983,35 @@ parse_equipment(xmlDocPtr doc)
xmlXPathObjectPtr xpathRaces; xmlXPathObjectPtr xpathRaces;
/* reading eressea/races/race */ /* reading eressea/races/race */
xpathRaces = xmlXPathEvalExpression(BAD_CAST "/eressea/equipment/startup", xpath); xpathRaces = xmlXPathEvalExpression(BAD_CAST "/eressea/equipment/set", xpath);
if (xpathRaces->nodesetval) { if (xpathRaces->nodesetval) {
xmlNodeSetPtr nsetRaces = xpathRaces->nodesetval; xmlNodeSetPtr nsetRaces = xpathRaces->nodesetval;
int i; int i;
for (i=0;i!=nsetRaces->nodeNr;++i) { for (i=0;i!=nsetRaces->nodeNr;++i) {
xmlNodePtr node = nsetRaces->nodeTab[i]; xmlNodePtr node = nsetRaces->nodeTab[i];
const struct race * rc = NULL; xmlChar * property = xmlGetProp(node, BAD_CAST "name");
xmlChar * property = xmlGetProp(node, BAD_CAST "race");
xmlXPathObjectPtr xpathResult;
if (property!=NULL) { if (property!=NULL) {
rc = rc_find((const char*)property); equipment * eq = create_equipment((const char*)property);
assert(rc!=NULL); xmlXPathObjectPtr xpathResult;
xpath->node = node;
xpathResult = xmlXPathEvalExpression(BAD_CAST "item", xpath);
add_items(eq, xpathResult->nodesetval);
xmlXPathFreeObject(xpathResult);
xpathResult = xmlXPathEvalExpression(BAD_CAST "skill", xpath);
add_skills(eq, xpathResult->nodesetval);
xmlXPathFreeObject(xpathResult);
xpathResult = xmlXPathEvalExpression(BAD_CAST "subset", xpath);
add_subsets(doc, eq, xpathResult->nodesetval);
xmlXPathFreeObject(xpathResult);
xmlFree(property);
} }
xpath->node = node;
xpathResult = xmlXPathEvalExpression(BAD_CAST "item", xpath);
add_items(xpathResult->nodesetval, rc);
xmlXPathFreeObject(xpathResult);
xpath->node = node;
xpathResult = xmlXPathEvalExpression(BAD_CAST "skill", xpath);
add_skills(xpathResult->nodesetval, rc);
xmlXPathFreeObject(xpathResult);
} }
} }

View File

@ -14,6 +14,7 @@
// kernel includes // kernel includes
#include <kernel/alliance.h> #include <kernel/alliance.h>
#include <kernel/equipment.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/plane.h> #include <kernel/plane.h>
@ -38,13 +39,11 @@
using namespace luabind; using namespace luabind;
static int static int
lua_addequipment(const char * iname, int number, const char * rcname) lua_addequipment(const char * eqname, const char * iname, const char * value)
{ {
race * rc = rc_find(rcname);
const struct item_type * itype = it_find(iname); const struct item_type * itype = it_find(iname);
if (rc==NULL && strlen(rcname)>0) return -1;
if (itype==NULL) return -1; if (itype==NULL) return -1;
startup_equipment(itype, number, rc); equipment_setitem(create_equipment(eqname), itype, value);
return 0; return 0;
} }
@ -212,6 +211,12 @@ lua_writereports(void)
return reports(); return reports();
} }
static void
lua_equipunit(unit& u, const char * eqname)
{
equip_unit(&u, get_equipment(eqname));
}
void void
bind_eressea(lua_State * L) bind_eressea(lua_State * L)
{ {
@ -229,10 +234,12 @@ bind_eressea(lua_State * L)
def("write_summary", &write_summary), def("write_summary", &write_summary),
def("read_orders", &readorders), def("read_orders", &readorders),
def("process_orders", &process_orders), def("process_orders", &process_orders),
def("startup_equipment", &lua_addequipment), def("equipment_setitem", &lua_addequipment),
def("get_turn", &get_turn), def("get_turn", &get_turn),
def("remove_empty_units", &remove_empty_units), def("remove_empty_units", &remove_empty_units),
def("equip_unit", &lua_equipunit),
/* scripted monsters */ /* scripted monsters */
def("plan_monsters", &lua_planmonsters), def("plan_monsters", &lua_planmonsters),
def("spawn_braineaters", &spawn_braineaters), def("spawn_braineaters", &spawn_braineaters),

View File

@ -1,41 +1,44 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<equipment> <equipment>
<!-- removed. only used by the mapper's seed function.
<item name="conquesttoken" amount="1"/> <!-- one equipment-set per player-race for the first unit in a faction -->
<item name="log" amount="30"/> <set name="dwarf">
<item name="stone" amount="30"/>
<item name="money" amount="4200"/>
-->
<startup race="dwarf">
<item name="axe" amount="1"/> <item name="axe" amount="1"/>
<item name="chainmail" amount="1"/> <item name="chainmail" amount="1"/>
<skill name="sk_melee" level="1"/> <skill name="sk_melee" level="1"/>
</startup> </set>
<startup race="elf">
<set name="elf">
<item name="fairyboot" amount="1"/> <item name="fairyboot" amount="1"/>
</startup> </set>
<startup race="uruk">
<set name="uruk">
<skill name="sk_spear" level="4"/> <skill name="sk_spear" level="4"/>
<skill name="sk_melee" level="4"/> <skill name="sk_melee" level="4"/>
<skill name="sk_crossbow" level="4"/> <skill name="sk_crossbow" level="4"/>
<skill name="sk_catapult" level="4"/> <skill name="sk_catapult" level="4"/>
<skill name="sk_bow" level="4"/> <skill name="sk_bow" level="4"/>
</startup> </set>
<startup race="goblin">
<set name="goblin">
<item name="roi" amount="1"/> <item name="roi" amount="1"/>
</startup> </set>
<startup race="troll">
<set name="troll">
<skill name="sk_building" level="1"/> <skill name="sk_building" level="1"/>
<skill name="sk_perception" level="3"/> <skill name="sk_perception" level="3"/>
<item name="stone" amount="50"/> <item name="stone" amount="50"/>
</startup> </set>
<startup race="demon">
<set name="demon">
<skill name="sk_stamina" level="15"/> <skill name="sk_stamina" level="15"/>
</startup> </set>
<startup race="insect">
<set name="insect">
<item name="nestwarmth" amount="9"/> <item name="nestwarmth" amount="9"/>
</startup> </set>
<startup race="halfling">
<set name="halfling">
<skill name="sk_trade" level="1"/> <skill name="sk_trade" level="1"/>
<skill name="sk_riding" level="2"/> <skill name="sk_riding" level="2"/>
<item name="horse" amount="2"/> <item name="horse" amount="2"/>
@ -47,12 +50,121 @@
<item name="oil" amount="5"/> <item name="oil" amount="5"/>
<item name="silk" amount="5"/> <item name="silk" amount="5"/>
<item name="incense" amount="5"/> <item name="incense" amount="5"/>
</startup> </set>
<startup race="cat">
<set name="cat">
<item name="roi" amount="1"/> <item name="roi" amount="1"/>
</startup> </set>
<startup race="aquarian">
<set name="aquarian">
<skill name="sk_sailing" level="1"/> <skill name="sk_sailing" level="1"/>
</startup> </set>
<!-- equipment-sets for random encounters -->
<set name="random_desert">
<skill name="sk_melee" level="d2"/>
<skill name="sk_trade" level="d3"/>
<skill name="sk_riding" level="d2+1"/>
<skill name="sk_training" level="d2+1"/>
<item name="horse" amount="1"/>
<item name="sword" amount="1"/>
<item name="money" amount="d30+19"/>
</set>
<set name="random_swamp">
<skill name="sk_stealth" level="d3+1"/>
<skill name="sk_spear" level="d3+1"/>
<item name="spear" amount="1"/>
<item name="money" amount="d20+9"/>
</set>
<set name="random_glacier">
<skill name="sk_armorer" level="d2+1"/>
<skill name="sk_melee" level="d2+1"/>
<item name="sword" amount="1"/>
<item name="money" amount="d20+19"/>
</set>
<set name="random_mountain">
<skill name="sk_armorer" level="d2+1"/>
<skill name="sk_melee" level="d2+1"/>
<skill name="sk_trade" level="d3"/>
<item name="sword" amount="1"/>
<item name="money" amount="d40+59"/>
<subset chance="0.6">
<set name="random_plate"/>
</subset>
</set>
<set name="random_highland">
<skill name="sk_melee" level="d2"/>
<item name="sword" amount="1"/>
<item name="money" amount="d10+19"/>
</set>
<set name="random_forest">
<skill name="sk_stealth" level="d2"/>
<skill name="sk_perception" level="d2+1"/>
<skill name="sk_bow" level="d3+1"/>
<item name="bow" amount="1"/>
<item name="money" amount="d20+9"/>
<subset chance="0.2">
<set name="random_herbalist"/>
</subset>
</set>
<set name="random_herbalist">
<skill name="sk_herbalism" level="d2"/>
</set>
<set name="random_plain">
<item name="money" amount="d80+19"/>
<subset>
<set name="random_sword" chance="0.25"/>
<set name="random_spear" chance="0.25"/>
<set name="random_crossbow" chance="0.25"/>
<set name="random_bow" chance="0.25"/>
</subset>
<subset chance="0.4">
<set name="random_chain"/>
</subset>
<subset chance="0.3">
<set name="random_rider"/>
</subset>
</set>
<set name="random_spear">
<skill name="sk_spear" level="d3"/>
<item name="spear" amount="1"/>
</set>
<set name="random_sword">
<skill name="sk_sword" level="d3"/>
<item name="sword" amount="1"/>
</set>
<set name="random_crossbow">
<skill name="sk_crossbow" level="d3"/>
<item name="crossbow" amount="1"/>
</set>
<set name="random_bow">
<skill name="sk_bow" level="d3"/>
<item name="bow" amount="1"/>
</set>
<set name="random_plate">
<item name="plate" amount="1"/>
</set>
<set name="random_chain">
<item name="chainmail" amount="1"/>
</set>
<set name="random_rider">
<item name="horse" amount="1"/>
<skill name="sk_riding" level="d3"/>
</set>
</equipment> </equipment>

View File

@ -20,10 +20,10 @@ end
function process(orders) function process(orders)
-- initialize starting equipment for new players -- initialize starting equipment for new players
startup_equipment("conquesttoken", 1, ""); equipment_setitem("new_faction", "conquesttoken", "1");
startup_equipment("wood", 30, ""); equipment_setitem("new_faction", "wood", "30");
startup_equipment("stone", 30, ""); equipment_setitem("new_faction", "stone", "30");
startup_equipment("money", 4200, ""); equipment_setitem("new_faction", "money", "4200");
file = "" .. get_turn() file = "" .. get_turn()
if read_game(file)~=0 then if read_game(file)~=0 then

View File

@ -54,10 +54,10 @@ end
function process(orders) function process(orders)
-- initialize starting equipment for new players -- initialize starting equipment for new players
startup_equipment("conquesttoken", 1, ""); equipment_setitem("new_faction", "conquesttoken", "1");
startup_equipment("log", 30, ""); equipment_setitem("new_faction", "log", "30");
startup_equipment("stone", 30, ""); equipment_setitem("new_faction", "stone", "30");
startup_equipment("money", 4200, ""); equipment_setitem("new_faction", "money", "4200");
file = "" .. get_turn() file = "" .. get_turn()
if read_game(file)~=0 then if read_game(file)~=0 then

View File

@ -124,7 +124,7 @@ skills = {
function wdw_setup() function wdw_setup()
-- initialize starting equipment for new players -- initialize starting equipment for new players
-- startup_equipment("magicskillboost", 1, "") -- equipment_setitem("new_faction", "magicskillboost", "1")
init_positions() init_positions()