forked from github/server
asgard rules:
- creating xml definitions - creating separate lua files - added option to make work automatic
This commit is contained in:
parent
a5d17f6c24
commit
3b9d951556
24 changed files with 2568 additions and 210 deletions
|
@ -1115,6 +1115,7 @@ cr_borders(seen_region ** seen, const region * r, const faction * f, int seemode
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cr_output_resources(FILE * F, report_context * ctx, region * r, struct rawmaterial * res, int see_mode)
|
||||
{
|
||||
|
@ -1251,7 +1252,7 @@ cr_output_region(FILE * F, report_context * ctx, seen_region * sr)
|
|||
|
||||
if (sr->mode>=see_unit) {
|
||||
/* trade */
|
||||
if (!TradeDisabled() && rpeasants(r)/TRADE_FRACTION > 0) {
|
||||
if (rpeasants(r)/TRADE_FRACTION > 0) {
|
||||
struct demand * dmd = r->land->demands;
|
||||
fputs("PREISE\n", F);
|
||||
while (dmd) {
|
||||
|
|
|
@ -90,8 +90,6 @@ typedef struct request {
|
|||
} type;
|
||||
} request;
|
||||
|
||||
static request workers[1024];
|
||||
static request *nextworker;
|
||||
static int working;
|
||||
|
||||
static request entertainers[1024];
|
||||
|
@ -1158,8 +1156,7 @@ recruit_classic(void)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "recruit.classic");
|
||||
value = str?atoi(str):1;
|
||||
value = get_param_int(global.parameters, "recruit.classic", 1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -1169,8 +1166,7 @@ recruit_archetypes(void)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "recruit.archetypes");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "recruit.archetypes", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -2954,7 +2950,7 @@ entertain_cmd(unit * u, struct order * ord)
|
|||
|
||||
|
||||
static void
|
||||
expandwork(region * r)
|
||||
expandwork(region * r, request * work_begin, request * work_end)
|
||||
{
|
||||
int n, earnings;
|
||||
/* n: verbleibende Einnahmen */
|
||||
|
@ -2964,7 +2960,7 @@ expandwork(region * r)
|
|||
int verdienst = 0;
|
||||
request *o;
|
||||
|
||||
for (o = &workers[0]; o != nextworker; ++o) {
|
||||
for (o = work_begin; o != work_end; ++o) {
|
||||
unit * u = o->unit;
|
||||
int workers;
|
||||
|
||||
|
@ -3000,33 +2996,38 @@ expandwork(region * r)
|
|||
rsetmoney(r, rmoney(r) + earnings);
|
||||
}
|
||||
|
||||
static void
|
||||
work_cmd(unit * u, order * ord)
|
||||
static int
|
||||
do_work(unit * u, order * ord, request * o)
|
||||
{
|
||||
region * r = u->region;
|
||||
request *o;
|
||||
int w;
|
||||
if (playerrace(u->race)) {
|
||||
region * r = u->region;
|
||||
int w;
|
||||
|
||||
if(fval(u, UFL_WERE)) {
|
||||
cmistake(u, ord, 313, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
if (u->ship && is_guarded(r, u, GUARD_CREWS)) {
|
||||
cmistake(u, ord, 69, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
w = wage(r, u->faction, u->race);
|
||||
u->wants = u->number * w;
|
||||
o = nextworker++;
|
||||
o->unit = u;
|
||||
o->qty = u->number * w;
|
||||
working += u->number;
|
||||
if(fval(u, UFL_WERE)) {
|
||||
cmistake(u, ord, 313, MSG_INCOME);
|
||||
return -1;
|
||||
}
|
||||
if (besieged(u)) {
|
||||
cmistake(u, ord, 60, MSG_INCOME);
|
||||
return -1;
|
||||
}
|
||||
if (u->ship && is_guarded(r, u, GUARD_CREWS)) {
|
||||
cmistake(u, ord, 69, MSG_INCOME);
|
||||
return -1;
|
||||
}
|
||||
w = wage(r, u->faction, u->race);
|
||||
u->wants = u->number * w;
|
||||
o->unit = u;
|
||||
o->qty = u->number * w;
|
||||
working += u->number;
|
||||
return 0;
|
||||
}
|
||||
else if (!is_monsters(u->faction)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, ord, "race_cantwork", "race", u->race));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
expandtax(region * r, request * taxorders)
|
||||
|
@ -3111,15 +3112,35 @@ tax_cmd(unit * u, struct order * ord, request ** taxorders)
|
|||
addlist(taxorders, o);
|
||||
return;
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
auto_work(region * r)
|
||||
{
|
||||
request workers[1024];
|
||||
request * nextworker = workers;
|
||||
unit * u;
|
||||
|
||||
for (u=r->units;u;u=u->next) {
|
||||
if (!(u->flags & UFL_LONGACTION) && !is_monsters(u->faction)) {
|
||||
if (do_work(u, NULL, nextworker)==0) {
|
||||
++nextworker;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextworker!=workers) {
|
||||
expandwork(r, workers, nextworker);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
produce(void)
|
||||
{
|
||||
request workers[1024];
|
||||
region *r;
|
||||
request *taxorders, *sellorders, *stealorders, *buyorders;
|
||||
unit *u;
|
||||
int todo;
|
||||
int autowork = get_param_int(global.parameters, "work.auto", 0);
|
||||
|
||||
/* das sind alles befehle, die 30 tage brauchen, und die in thisorder
|
||||
* stehen! von allen 30-tage befehlen wird einfach der letzte verwendet
|
||||
|
@ -3133,13 +3154,13 @@ produce(void)
|
|||
|
||||
for (r = regions; r; r = r->next) {
|
||||
boolean limited = true;
|
||||
request * nextworker = workers;
|
||||
|
||||
assert(rmoney(r) >= 0);
|
||||
assert(rpeasants(r) >= 0);
|
||||
|
||||
buyorders = 0;
|
||||
sellorders = 0;
|
||||
nextworker = &workers[0];
|
||||
working = 0;
|
||||
nextentertainer = &entertainers[0];
|
||||
entertaining = 0;
|
||||
|
@ -3147,6 +3168,9 @@ produce(void)
|
|||
stealorders = 0;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
order * ord;
|
||||
boolean trader = false;
|
||||
|
||||
if (u->race == new_race[RC_SPELL] || fval(u, UFL_LONGACTION))
|
||||
continue;
|
||||
|
||||
|
@ -3159,31 +3183,27 @@ produce(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!TradeDisabled()) {
|
||||
order * ord;
|
||||
boolean trader = false;
|
||||
for (ord = u->orders;ord;ord=ord->next) {
|
||||
switch (get_keyword(ord)) {
|
||||
case K_BUY:
|
||||
buy(u, &buyorders, ord);
|
||||
trader = true;
|
||||
break;
|
||||
case K_SELL:
|
||||
/* sell returns true if the sale is not limited
|
||||
* by the region limit */
|
||||
limited &= !sell(u, &sellorders, ord);
|
||||
trader = true;
|
||||
break;
|
||||
}
|
||||
for (ord = u->orders;ord;ord=ord->next) {
|
||||
switch (get_keyword(ord)) {
|
||||
case K_BUY:
|
||||
buy(u, &buyorders, ord);
|
||||
trader = true;
|
||||
break;
|
||||
case K_SELL:
|
||||
/* sell returns true if the sale is not limited
|
||||
* by the region limit */
|
||||
limited &= !sell(u, &sellorders, ord);
|
||||
trader = true;
|
||||
break;
|
||||
}
|
||||
if (trader) {
|
||||
attrib * a = a_find(u->attribs, &at_trades);
|
||||
if (a && a->data.i) {
|
||||
produceexp(u, SK_TRADE, u->number);
|
||||
}
|
||||
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
|
||||
continue;
|
||||
}
|
||||
if (trader) {
|
||||
attrib * a = a_find(u->attribs, &at_trades);
|
||||
if (a && a->data.i) {
|
||||
produceexp(u, SK_TRADE, u->number);
|
||||
}
|
||||
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
|
||||
continue;
|
||||
}
|
||||
|
||||
todo = get_keyword(u->thisorder);
|
||||
|
@ -3201,10 +3221,8 @@ produce(void)
|
|||
break;
|
||||
|
||||
case K_WORK:
|
||||
if (playerrace(u->race)) work_cmd(u, u->thisorder);
|
||||
else if (playerrace(u->faction->race)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "race_cantwork", "race", u->race));
|
||||
if (!autowork && do_work(u, u->thisorder, nextworker)==0) {
|
||||
++nextworker;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3240,7 +3258,7 @@ produce(void)
|
|||
* letzten Runde berechnen kann, wieviel die Bauern für Unterhaltung
|
||||
* auszugeben bereit sind. */
|
||||
if (entertaining) expandentertainment(r);
|
||||
expandwork(r);
|
||||
if (!autowork) expandwork(r, workers, nextworker);
|
||||
if (taxorders) expandtax(r, taxorders);
|
||||
|
||||
/* An erster Stelle Kaufen (expandbuying), die Bauern so Geld bekommen, um
|
||||
|
|
|
@ -49,6 +49,7 @@ extern int income(const struct unit * u);
|
|||
|
||||
void economics(struct region *r);
|
||||
void produce(void);
|
||||
void auto_work(struct region * r);
|
||||
|
||||
enum { IC_WORK, IC_ENTERTAIN, IC_TAX, IC_TRADE, IC_TRADETAX, IC_STEAL, IC_MAGIC };
|
||||
void maintain_buildings(struct region * r, boolean crash);
|
||||
|
|
|
@ -3549,11 +3549,13 @@ add_proc(int priority, const char * name, int type)
|
|||
void
|
||||
add_proc_order(int priority, keyword_t kword, int (*parser)(struct unit *, struct order *), unsigned int flags, const char * name)
|
||||
{
|
||||
processor * proc = add_proc(priority, name, PR_ORDER);
|
||||
if (proc) {
|
||||
proc->data.per_order.process = parser;
|
||||
proc->data.per_order.kword = kword;
|
||||
proc->flags = flags;
|
||||
if (!global.disabled[kword]) {
|
||||
processor * proc = add_proc(priority, name, PR_ORDER);
|
||||
if (proc) {
|
||||
proc->data.per_order.process = parser;
|
||||
proc->data.per_order.kword = kword;
|
||||
proc->flags = flags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3756,7 +3758,7 @@ init_processor(void)
|
|||
add_proc_order(p, K_PREFIX, &prefix_cmd, 0, NULL);
|
||||
add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, 0, NULL);
|
||||
add_proc_order(p, K_STATUS, &status_cmd, 0, NULL);
|
||||
add_proc_order(p, K_COMBAT, &combatspell_cmd, 0, NULL);
|
||||
add_proc_order(p, K_COMBATSPELL, &combatspell_cmd, 0, NULL);
|
||||
add_proc_order(p, K_DISPLAY, &display_cmd, 0, NULL);
|
||||
add_proc_order(p, K_NAME, &name_cmd, 0, NULL);
|
||||
add_proc_order(p, K_GUARD, &guard_off_cmd, 0, NULL);
|
||||
|
@ -3800,8 +3802,10 @@ init_processor(void)
|
|||
add_proc_region(p, &do_battle, "Attackieren");
|
||||
}
|
||||
|
||||
p+=10; /* after combat, reset rng */
|
||||
add_proc_region(p, &do_siege, "Belagern");
|
||||
if (!global.disabled[K_BESIEGE]) {
|
||||
p+=10;
|
||||
add_proc_region(p, &do_siege, "Belagern");
|
||||
}
|
||||
|
||||
p+=10; /* can't allow reserve before siege (weapons) */
|
||||
add_proc_region(p, &enter_1, "Kontaktieren & Betreten (2. Versuch)");
|
||||
|
@ -3816,15 +3820,17 @@ init_processor(void)
|
|||
|
||||
p+=10; /* QUIT fuer sich alleine */
|
||||
add_proc_global(p, &quit, "Sterben");
|
||||
add_proc_global(p, &parse_restart, "Neustart");
|
||||
|
||||
p+=10;
|
||||
add_proc_global(p, &magic, "Zaubern");
|
||||
|
||||
p+=10;
|
||||
if (!global.disabled[K_TEACH]) {
|
||||
add_proc_order(p, K_TEACH, &teach_cmd, PROC_THISORDER|PROC_LONGORDER, "Lehren");
|
||||
if (!global.disabled[K_RESTART]) {
|
||||
add_proc_global(p, &parse_restart, "Neustart");
|
||||
}
|
||||
|
||||
if (!global.disabled[K_CAST]) {
|
||||
p+=10;
|
||||
add_proc_global(p, &magic, "Zaubern");
|
||||
}
|
||||
|
||||
p+=10;
|
||||
add_proc_order(p, K_TEACH, &teach_cmd, PROC_THISORDER|PROC_LONGORDER, "Lehren");
|
||||
p+=10;
|
||||
add_proc_order(p, K_STUDY, &learn_cmd, PROC_THISORDER|PROC_LONGORDER, "Lernen");
|
||||
|
||||
|
@ -3842,11 +3848,16 @@ init_processor(void)
|
|||
p+=10;
|
||||
add_proc_global(p, &movement, "Bewegungen");
|
||||
|
||||
if (get_param_int(global.parameters, "work.auto", 0)) {
|
||||
p+=10;
|
||||
add_proc_region(p, &auto_work, "Arbeiten (auto)");
|
||||
}
|
||||
|
||||
p+=10;
|
||||
add_proc_order(p, K_GUARD, &guard_on_cmd, 0, "Bewache (an)");
|
||||
#if XECMD_MODULE
|
||||
/* can do together with guard */
|
||||
add_proc_order(p, K_LEAVE, &xecmd, 0, "Zeitung");
|
||||
add_proc_order(p, K_XE, &xecmd, 0, "Zeitung");
|
||||
#endif
|
||||
|
||||
p+=10;
|
||||
|
@ -3860,14 +3871,18 @@ init_processor(void)
|
|||
p+=10;
|
||||
add_proc_global(p, &monthly_healing, "Regeneration (HP)");
|
||||
add_proc_global(p, ®eneration_magiepunkte, "Regeneration (Aura)");
|
||||
add_proc_global(p, &defaultorders, "Defaults setzen");
|
||||
if (!global.disabled[K_DEFAULT]) {
|
||||
add_proc_global(p, &defaultorders, "Defaults setzen");
|
||||
}
|
||||
add_proc_global(p, &demographics, "Nahrung, Seuchen, Wachstum, Wanderung");
|
||||
|
||||
p+=10;
|
||||
add_proc_region(p, &maintain_buildings_2, "Gebaeudeunterhalt (2. Versuch)");
|
||||
|
||||
p+=10;
|
||||
add_proc_global(p, &reorder, "Einheiten sortieren");
|
||||
if (!global.disabled[K_SORT]) {
|
||||
p+=10;
|
||||
add_proc_global(p, &reorder, "Einheiten sortieren");
|
||||
}
|
||||
#if KARMA_MODULE
|
||||
p+=10;
|
||||
add_proc_global(p, &karma, "Jihads setzen");
|
||||
|
@ -3881,10 +3896,11 @@ init_processor(void)
|
|||
add_proc_global(p, &declare_war, "Krieg & Frieden");
|
||||
#endif
|
||||
add_proc_order(p, K_PROMOTION, &promotion_cmd, 0, "Heldenbefoerderung");
|
||||
add_proc_order(p, K_NUMBER, &renumber_cmd, 0, "Neue Nummern (Einheiten)");
|
||||
|
||||
p+=10;
|
||||
add_proc_global(p, &renumber_factions, "Neue Nummern");
|
||||
if (!global.disabled[K_NUMBER]) {
|
||||
add_proc_order(p, K_NUMBER, &renumber_cmd, 0, "Neue Nummern (Einheiten)");
|
||||
p+=10;
|
||||
add_proc_global(p, &renumber_factions, "Neue Nummern");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -330,7 +330,7 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
|
|||
size = sizeof(buf) - 1;
|
||||
|
||||
if (sp->sptyp & ISCOMBATSPELL) {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, keywords[K_COMBAT]), size);
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, keywords[K_COMBATSPELL]), size);
|
||||
} else {
|
||||
bytes = (int)strlcpy(bufp, LOC(lang, keywords[K_CAST]), size);
|
||||
}
|
||||
|
@ -1215,18 +1215,16 @@ statistics(FILE * F, const region * r, const faction * f)
|
|||
rparagraph(F, buf, 2, 2, 0);
|
||||
msg_release(m);
|
||||
|
||||
if (!TradeDisabled()) {
|
||||
if (buildingtype_exists(r, bt_find("caravan"))) {
|
||||
m = msg_message("nr_stat_luxuries", "max",
|
||||
(p * 2) / TRADE_FRACTION);
|
||||
} else {
|
||||
m = msg_message("nr_stat_luxuries", "max",
|
||||
p / TRADE_FRACTION);
|
||||
}
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
rparagraph(F, buf, 2, 2, 0);
|
||||
msg_release(m);
|
||||
if (buildingtype_exists(r, bt_find("caravan"))) {
|
||||
m = msg_message("nr_stat_luxuries", "max",
|
||||
(p * 2) / TRADE_FRACTION);
|
||||
} else {
|
||||
m = msg_message("nr_stat_luxuries", "max",
|
||||
p / TRADE_FRACTION);
|
||||
}
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
rparagraph(F, buf, 2, 2, 0);
|
||||
msg_release(m);
|
||||
}
|
||||
/* info about units */
|
||||
|
||||
|
@ -2163,7 +2161,7 @@ report_plaintext(const char * filename, report_context * ctx, const char * chars
|
|||
if (sr->mode==see_unit) {
|
||||
anyunits = 1;
|
||||
describe(F, r, 0, f);
|
||||
if (!TradeDisabled() && !fval(r->terrain, SEA_REGION) && rpeasants(r)/TRADE_FRACTION > 0) {
|
||||
if (!fval(r->terrain, SEA_REGION) && rpeasants(r)/TRADE_FRACTION > 0) {
|
||||
rnl(F);
|
||||
prices(F, r, f);
|
||||
}
|
||||
|
|
|
@ -76,8 +76,7 @@ CheckOverload(void)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "rules.check_overload");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "rules.check_overload", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -117,8 +117,7 @@ int
|
|||
NewbieImmunity(void) {
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "NewbieImmunity");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "NewbieImmunity", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -127,8 +126,7 @@ static int
|
|||
MaxAge(void) {
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "MaxAge");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "MaxAge", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -151,8 +149,7 @@ ExpensiveMigrants(void)
|
|||
{
|
||||
int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "study.expensivemigrants");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "study.expensivemigrants", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -207,8 +204,7 @@ LongHunger(const struct unit * u) {
|
|||
#endif
|
||||
}
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "hunger.long");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "hunger.long", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -218,18 +214,7 @@ SkillCap(skill_t sk) {
|
|||
static int value = -1;
|
||||
if (sk==SK_MAGIC) return 0; /* no caps on magic */
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "skill.maxlevel");
|
||||
value = str?atoi(str):0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
boolean
|
||||
TradeDisabled(void) {
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "trade.disabled");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "skill.maxlevel", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -238,8 +223,7 @@ int
|
|||
NMRTimeout(void) {
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "nmr.timeout");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "nmr.timeout", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -470,8 +454,7 @@ allied_skilllimit(const faction * f, skill_t sk)
|
|||
{
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "alliance.skilllimit");
|
||||
value = str?atoi(str):0;
|
||||
value = get_param_int(global.parameters, "alliance.skilllimit", 0);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -2110,23 +2093,19 @@ init_locale(const struct locale * lang)
|
|||
#if PTRIES
|
||||
ptrie = get_ptrie(lang, UT_SKILLS);
|
||||
for (i=0;i!=MAXSKILLS;++i) {
|
||||
if (i!=SK_TRADE || !TradeDisabled()) {
|
||||
skill_t sk = (skill_t)i;
|
||||
const char * skname = skillname(sk, lang);
|
||||
if (skname!=NULL) {
|
||||
ptrie_insert(ptrie, skname, &sk, sizeof(sk));
|
||||
}
|
||||
skill_t sk = (skill_t)i;
|
||||
const char * skname = skillname(sk, lang);
|
||||
if (skname!=NULL) {
|
||||
ptrie_insert(ptrie, skname, &sk, sizeof(sk));
|
||||
}
|
||||
}
|
||||
#else
|
||||
tokens = get_translations(lang, UT_SKILLS);
|
||||
for (i=0;i!=MAXSKILLS;++i) {
|
||||
if (i!=SK_TRADE || !TradeDisabled()) {
|
||||
const char * skname = skillname((skill_t)i, lang);
|
||||
if (skname!=NULL) {
|
||||
var.i = i;
|
||||
addtoken(tokens, skname, var);
|
||||
}
|
||||
const char * skname = skillname((skill_t)i, lang);
|
||||
if (skname!=NULL) {
|
||||
var.i = i;
|
||||
addtoken(tokens, skname, var);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2177,6 +2156,17 @@ get_param(const struct param * p, const char * key)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
get_param_int(const struct param * p, const char * key, int def)
|
||||
{
|
||||
while (p!=NULL) {
|
||||
if (strcmp(p->name, key)==0) return atoi(p->data);
|
||||
p = p->next;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
set_param(struct param ** p, const char * key, const char * data)
|
||||
|
|
|
@ -396,11 +396,11 @@ extern const char * dbrace(const struct race * rc);
|
|||
|
||||
extern void set_param(struct param ** p, const char * name, const char * data);
|
||||
extern const char* get_param(const struct param * p, const char * name);
|
||||
extern int get_param_int(const struct param * p, const char * name, int def);
|
||||
|
||||
extern boolean ExpensiveMigrants(void);
|
||||
extern int NMRTimeout(void);
|
||||
extern int LongHunger(const struct unit * u);
|
||||
extern boolean TradeDisabled(void);
|
||||
extern int SkillCap(skill_t sk);
|
||||
extern int NewbieImmunity(void);
|
||||
extern int AllianceAuto(void); /* flags that allied factions get automatically */
|
||||
|
|
|
@ -914,6 +914,10 @@ readregion(struct storage * store, short x, short y)
|
|||
if (store->version < TERRAIN_VERSION) {
|
||||
int ter = store->r_int(store);
|
||||
terrain = newterrain((terrain_t)ter);
|
||||
if (terrain==NULL) {
|
||||
log_error(("while reading datafile from pre-TERRAIN_VERSION, could not find terrain #%d.\n", ter));
|
||||
terrain = newterrain(T_PLAIN);
|
||||
}
|
||||
} else {
|
||||
char name[64];
|
||||
store->r_str_buf(store, name, sizeof(name));
|
||||
|
|
|
@ -77,7 +77,7 @@ const char *skillnames[MAXSKILLS] =
|
|||
"unarmed"
|
||||
};
|
||||
|
||||
static boolean skill_enabled[MAXSKILLS];
|
||||
boolean skill_enabled[MAXSKILLS];
|
||||
|
||||
const char *
|
||||
skillname(skill_t sk, const struct locale * lang)
|
||||
|
|
|
@ -60,6 +60,7 @@ extern int skill_compare(const skill * sk, const skill * sc);
|
|||
extern void sk_set(skill * sv, int level);
|
||||
|
||||
extern const char *skillnames[];
|
||||
extern boolean skill_enabled[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#define MAXTERRAINS 20
|
||||
|
||||
const char * terraindata[] = {
|
||||
const char * terraindata[MAXTERRAINS] = {
|
||||
"ocean",
|
||||
"plain",
|
||||
"swamp",
|
||||
|
@ -47,8 +47,8 @@ const char * terraindata[] = {
|
|||
"mountain",
|
||||
"glacier",
|
||||
"firewall",
|
||||
"hell", /* dungeon module */
|
||||
"plain", /* former grassland */
|
||||
NULL, /* dungeon module */
|
||||
NULL, /* former grassland */
|
||||
"fog",
|
||||
"thickfog",
|
||||
"volcano",
|
||||
|
@ -56,11 +56,10 @@ const char * terraindata[] = {
|
|||
"iceberg_sleep",
|
||||
"iceberg",
|
||||
|
||||
"hall1", /* museum module */
|
||||
"corridor1", /* museum module */
|
||||
"plain", /* former magicstorm */
|
||||
"wall1", /* museum module */
|
||||
NULL
|
||||
NULL, /* museum module */
|
||||
NULL, /* museum module */
|
||||
NULL, /* former magicstorm */
|
||||
NULL /* museum module */
|
||||
};
|
||||
|
||||
static terrain_type * registered_terrains;
|
||||
|
@ -142,11 +141,13 @@ init_terrains(void)
|
|||
for (t=0;t!=MAXTERRAINS;++t) {
|
||||
const terrain_type * newterrain = newterrains[t];
|
||||
if (newterrain!=NULL) continue;
|
||||
newterrain = get_terrain(terraindata[t]);
|
||||
if (newterrain!=NULL) {
|
||||
newterrains[t] = newterrain;
|
||||
} else {
|
||||
log_warning(("missing classic terrain %s\n", terraindata[t]));
|
||||
if (terraindata[t]!=NULL) {
|
||||
newterrain = get_terrain(terraindata[t]);
|
||||
if (newterrain!=NULL) {
|
||||
newterrains[t] = newterrain;
|
||||
} else {
|
||||
log_warning(("missing classic terrain %s\n", terraindata[t]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ enum {
|
|||
K_GIVE,
|
||||
K_ALLY,
|
||||
K_STATUS,
|
||||
K_COMBAT,
|
||||
K_COMBATSPELL,
|
||||
K_BUY,
|
||||
K_CONTACT,
|
||||
K_TEACH,
|
||||
|
|
|
@ -852,6 +852,45 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
|||
return itype;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_rules(xmlDocPtr doc)
|
||||
{
|
||||
xmlXPathContextPtr xpath = xmlXPathNewContext(doc);
|
||||
xmlXPathObjectPtr functions;
|
||||
xmlNodeSetPtr nodes;
|
||||
int i;
|
||||
|
||||
/* reading eressea/resources/resource */
|
||||
functions = xmlXPathEvalExpression(BAD_CAST "/eressea/rules/function", xpath);
|
||||
nodes = functions->nodesetval;
|
||||
for (i=0;i!=nodes->nodeNr;++i) {
|
||||
xmlNodePtr node = nodes->nodeTab[i];
|
||||
xmlChar *propValue;
|
||||
pf_generic fun;
|
||||
|
||||
parse_function(node, &fun, &propValue);
|
||||
|
||||
if (fun==NULL) {
|
||||
log_error(("unknown function for rule '%s' %s\n", (const char*)propValue));
|
||||
xmlFree(propValue);
|
||||
continue;
|
||||
}
|
||||
assert(propValue!=NULL);
|
||||
if (strcmp((const char*)propValue, "wage")==0) {
|
||||
global.functions.wage = (int (*)(const struct region*, const struct faction*, const struct race*))fun;
|
||||
} else if (strcmp((const char*)propValue, "maintenance")==0) {
|
||||
global.functions.maintenance = (int (*)(const struct unit*))fun;
|
||||
} else {
|
||||
log_error(("unknown function for rule '%s'\n",
|
||||
(const char*)propValue));
|
||||
}
|
||||
xmlFree(propValue);
|
||||
}
|
||||
xmlXPathFreeObject(functions);
|
||||
xmlXPathFreeContext(xpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_resources(xmlDocPtr doc)
|
||||
{
|
||||
|
@ -2037,6 +2076,7 @@ register_xmlreader(void)
|
|||
xml_register_callback(parse_prefixes);
|
||||
xml_register_callback(parse_messages);
|
||||
xml_register_callback(parse_resources);
|
||||
xml_register_callback(parse_rules);
|
||||
|
||||
xml_register_callback(parse_terrains); /* requires resources */
|
||||
xml_register_callback(parse_buildings); /* requires resources */
|
||||
|
|
|
@ -256,7 +256,7 @@ fix_age(void)
|
|||
const race * uruk = rc_find("uruk");
|
||||
for (f=factions;f;f=f->next) {
|
||||
if (!is_monsters(f) && playerrace(f->race)) continue;
|
||||
if (f->race==oldorc) f->race= uruk;
|
||||
if (f->race==oldorc) f->race = uruk;
|
||||
else if (f->age!=turn) {
|
||||
log_printf("Alter von Partei %s auf %d angepasst.\n", factionid(f), turn);
|
||||
f->age = turn;
|
||||
|
|
|
@ -36,7 +36,9 @@
|
|||
#pragma warning (disable: 4127)
|
||||
#endif
|
||||
#include <luabind/luabind.hpp>
|
||||
#include <luabind/object.hpp>
|
||||
#if LUABIND_BETA >= 7
|
||||
# include <luabind/operator.hpp>
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
@ -229,35 +231,23 @@ lua_getresource(unit * u, const struct resource_type * rtype)
|
|||
return retval;
|
||||
}
|
||||
|
||||
struct script_interface {
|
||||
void destroy() {
|
||||
delete wage;
|
||||
wage = 0;
|
||||
delete maintenance;
|
||||
maintenance = 0;
|
||||
}
|
||||
object * wage;
|
||||
object * maintenance;
|
||||
};
|
||||
|
||||
static script_interface interface;
|
||||
|
||||
static int
|
||||
lua_wage(const region * r, const faction * f, const race * rc)
|
||||
{
|
||||
const char * fname = "wage";
|
||||
int retval = -1;
|
||||
lua_State * L = (lua_State *)global.vm_state;
|
||||
|
||||
assert(interface.wage);
|
||||
try {
|
||||
object o = interface.wage->operator()(r, f, rc);
|
||||
retval = object_cast<int>(o);
|
||||
}
|
||||
catch (error& e) {
|
||||
lua_State* L = e.state();
|
||||
const char* error = lua_tostring(L, -1);
|
||||
log_error(("An exception occured in interface 'wage': %s.\n", error));
|
||||
lua_pop(L, 1);
|
||||
std::terminate();
|
||||
if (is_function(L, fname)) {
|
||||
try {
|
||||
retval = luabind::call_function<int>(L, fname, r, f, rc?rc->_name[0]:NULL);
|
||||
}
|
||||
catch (luabind::error& e) {
|
||||
lua_State* L = e.state();
|
||||
const char* error = lua_tostring(L, -1);
|
||||
log_error(("An exception occured while calling '%s': %s.\n", fname, error));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -265,35 +255,24 @@ lua_wage(const region * r, const faction * f, const race * rc)
|
|||
static int
|
||||
lua_maintenance(const unit * u)
|
||||
{
|
||||
const char * fname = "maintenance";
|
||||
int retval = -1;
|
||||
assert(interface.maintenance);
|
||||
lua_State * L = (lua_State *)global.vm_state;
|
||||
|
||||
try {
|
||||
object o = interface.maintenance->operator()(u);
|
||||
retval = object_cast<int>(o);
|
||||
}
|
||||
catch (error& e) {
|
||||
lua_State* L = e.state();
|
||||
const char* error = lua_tostring(L, -1);
|
||||
log_error(("An exception occured in interface 'maintenance': %s.\n", error));
|
||||
lua_pop(L, 1);
|
||||
std::terminate();
|
||||
if (is_function(L, fname)) {
|
||||
try {
|
||||
retval = luabind::call_function<int>(L, fname, u);
|
||||
}
|
||||
catch (luabind::error& e) {
|
||||
lua_State* L = e.state();
|
||||
const char* error = lua_tostring(L, -1);
|
||||
log_error(("An exception occured while calling '%s': %s.\n", fname, error));
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
overload(const char * name, const object& f)
|
||||
{
|
||||
if (strcmp(name, "wage")==0) {
|
||||
global.functions.wage = &lua_wage;
|
||||
interface.wage = new object(f);
|
||||
} else if (strcmp(name, "maintenance")==0) {
|
||||
global.functions.maintenance = &lua_maintenance;
|
||||
interface.maintenance = new object(f);;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unit_setscript(struct unit& u, const luabind::object& f)
|
||||
{
|
||||
|
@ -343,8 +322,10 @@ bind_script(lua_State * L)
|
|||
register_function((pf_generic)&lua_changeresource, "lua_changeresource");
|
||||
register_function((pf_generic)&lua_equipmentcallback, "lua_equip");
|
||||
|
||||
register_function((pf_generic)&lua_wage, "lua_wage");
|
||||
register_function((pf_generic)&lua_maintenance, "lua_maintenance");
|
||||
|
||||
module(L)[
|
||||
def("overload", &overload),
|
||||
def("set_race_brain", &race_setscript),
|
||||
def("set_unit_brain", &unit_setscript)
|
||||
];
|
||||
|
@ -353,5 +334,4 @@ bind_script(lua_State * L)
|
|||
void
|
||||
reset_scripts()
|
||||
{
|
||||
interface.destroy();
|
||||
}
|
||||
|
|
134
src/res/asgard.xml
Normal file
134
src/res/asgard.xml
Normal file
|
@ -0,0 +1,134 @@
|
|||
<?xml version="1.0"?>
|
||||
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="messages.xml"/>
|
||||
|
||||
<!-- Localization -->
|
||||
<xi:include href="de/strings.xml"/>
|
||||
<xi:include href="en/strings.xml"/>
|
||||
|
||||
<xi:include href="asgard/items.xml"/>
|
||||
<xi:include href="asgard/races.xml"/>
|
||||
<xi:include href="asgard/terrains.xml"/>
|
||||
<xi:include href="asgard/rules.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
<xi:include href="buildings.xml"/>
|
||||
<xi:include href="calendar.xml"/>
|
||||
<xi:include href="equipment.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"/>
|
||||
</set>
|
||||
<set name="new_faction">
|
||||
<item name="adamantium" amount="4"/>
|
||||
</set>
|
||||
</equipment>
|
||||
|
||||
<xi:include href="names-undead.xml"/>
|
||||
<xi:include href="names-skeletons.xml"/>
|
||||
<xi:include href="names-zombies.xml"/>
|
||||
<xi:include href="names-ghouls.xml"/>
|
||||
<xi:include href="names-dragons.xml"/>
|
||||
|
||||
<game name="Asgard" units="1000">
|
||||
<!-- Game specific settings -->
|
||||
|
||||
<order name="BANNER" disable="yes"/>
|
||||
<order name="BELAGERE" disable="yes"/>
|
||||
<order name="BOTSCHAFT" disable="yes"/>
|
||||
<order name="DEFAULT" disable="yes"/>
|
||||
<order name="EMAIL" disable="yes"/>
|
||||
<order name="GRUPPE" disable="yes"/>
|
||||
<order name="KAMPFZAUBER" disable="yes"/>
|
||||
<order name="LEHREN" disable="yes"/>
|
||||
<order name="MAGIEGEBIET" disable="yes"/>
|
||||
<order name="MEINUNG" disable="yes"/>
|
||||
<order name="NEUSTART" disable="yes"/>
|
||||
<order name="NUMMER" disable="yes"/>
|
||||
<order name="OPTION" disable="yes"/>
|
||||
<order name="PASSWORT" disable="yes"/>
|
||||
<order name="PRAEFIX" disable="yes"/>
|
||||
<order name="RESERVIEREN" disable="yes"/>
|
||||
<order name="SABOTIEREN" disable="yes"/>
|
||||
<order name="SORTIEREN" disable="yes"/>
|
||||
<order name="TARNEN" disable="yes"/>
|
||||
<order name="URSPRUNG" disable="yes"/>
|
||||
<order name="VERGESSEN" disable="yes"/>
|
||||
<order name="ZAUBERE" disable="yes"/>
|
||||
<order name="ZEIGEN" disable="yes"/>
|
||||
<order name="XONTORMIA" disable="yes"/>
|
||||
|
||||
<order name="FAHREN" disable="yes"/>
|
||||
<order name="ZUECHTEN" disable="yes"/>
|
||||
<order name="PFLANZEN" disable="yes"/>
|
||||
<order name="TRANSPORTIEREN" disable="yes"/>
|
||||
<order name="TREIBEN" disable="yes"/>
|
||||
<order name="UNTERHALTEN" disable="yes"/>
|
||||
<order name="LIEFERE" disable="yes"/>
|
||||
|
||||
<skill name="alchemy" enable="false"/>
|
||||
<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="entertainment" enable="false"/>
|
||||
<skill name="espionage" enable="false"/>
|
||||
<skill name="forestry" enable="true"/>
|
||||
<skill name="herbalism" enable="false"/>
|
||||
<skill name="magic" enable="false"/>
|
||||
<skill name="melee" enable="true"/>
|
||||
<skill name="mining" enable="true"/>
|
||||
<skill name="perception" 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="stealth" enable="true"/>
|
||||
<skill name="tactics" enable="true"/>
|
||||
<skill name="taxation" enable="false"/>
|
||||
<skill name="trade" enable="true"/>
|
||||
<skill name="training" enable="true"/>
|
||||
<skill name="unarmed" enable="true"/>
|
||||
<skill name="weaponsmithing" enable="true"/>
|
||||
|
||||
<param name="NewbieImmunity" value="8"/>
|
||||
<param name="modules.wormholes" value="1"/>
|
||||
<param name="work.auto" value="1"/>
|
||||
<param name="nmr.timeout" value="4"/>
|
||||
<param name="nmr.removenewbie" value="10"/>
|
||||
<param name="GiveRestriction" value="3"/>
|
||||
<param name="hunger.long" value="1"/>
|
||||
<param name="rules.check_overload" value="0"/>
|
||||
</game>
|
||||
<xi:include href="eressea/strings.xml"/>
|
||||
<xi:include href="eressea/races.xml"/>
|
||||
<xi:include href="eressea/items.xml"/>
|
||||
<xi:include href="eressea/artrewards.xml"/>
|
||||
<xi:include href="eressea/dungeons.xml"/>
|
||||
<xi:include href="eressea/temple.xml"/>
|
||||
<strings>
|
||||
<string name="mailto">
|
||||
<text locale="de">eressea-server@eressea.kn-bremen.de</text>
|
||||
<text locale="en">eressea-server@eressea.kn-bremen.de</text>
|
||||
</string>
|
||||
<string name="newbie_info_1">
|
||||
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
|
||||
ERESSEA BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden.</text>
|
||||
<text locale="en">Remember to send your orders to
|
||||
eressea-server@eressea.kn-bremen.de with the subject ERESSEA ORDERS.</text>
|
||||
</string>
|
||||
<string name="mailcmd">
|
||||
<text locale="de">ERESSEA BEFEHLE</text>
|
||||
<text locale="en">ERESSEA ORDERS</text>
|
||||
</string>
|
||||
</strings>
|
||||
</eressea>
|
600
src/res/asgard/items.xml
Normal file
600
src/res/asgard/items.xml
Normal file
|
@ -0,0 +1,600 @@
|
|||
<?xml version="1.0"?>
|
||||
<resources>
|
||||
|
||||
<resource name="aoh" appearance="amulet">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="aots" appearance="amulet">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="roi" appearance="">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="rop" appearance="">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="roqf" appearance="">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="trollbelt">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="presspass" cursed="yes">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="aurafocus">
|
||||
<item weight="100" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="sphereofinv" appearance="">
|
||||
<item weight="100" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="magicbag">
|
||||
<item big="yes" notlost="yes" weight="100" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="magicherbbag" appearance="">
|
||||
<item weight="100" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="ao_chastity" appearance="amulet">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="fairyboot">
|
||||
<item weight="0" score="6000"/>
|
||||
</resource>
|
||||
|
||||
<resource name="aoc" appearance="amulet">
|
||||
<item weight="100">
|
||||
<function name="use" value="use_birthdayamulet"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="dreameye">
|
||||
<item weight="100">
|
||||
<function name="use" value="use_tacticcrystal"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="pegasus">
|
||||
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes"/>
|
||||
</resource>
|
||||
|
||||
<resource name="elvenhorse">
|
||||
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes">
|
||||
<function name="give" value="givehorses"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="dolphin">
|
||||
<item weight="5000" notlost="yes" big="yes" score="6000" capacity="7000" animal="yes"/>
|
||||
</resource>
|
||||
|
||||
<resource name="iron" limited="yes">
|
||||
<item weight="500" score="10">
|
||||
<construction skill="mining" minskill="1" reqsize="1"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<modifier building="mine" type="skill" value="1"/>
|
||||
<modifier building="mine" type="material" value="0.5"/>
|
||||
<modifier race="dwarf" type="material" value="0.75"/>
|
||||
<guard flag="mining"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<resource name="laen" limited="yes">
|
||||
<item weight="200" score="100">
|
||||
<construction skill="mining" minskill="7" reqsize="1"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<guard flag="mining"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<resource name="stone" limited="yes">
|
||||
<item weight="6000" score="10" big="yes">
|
||||
<construction skill="quarrying" minskill="1" reqsize="1"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<modifier building="quarry" type="skill" value="1"/>
|
||||
<modifier building="quarry" type="material" value="0.5"/>
|
||||
<modifier race="troll" type="material" value="0.75"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<resource name="horse" limited="yes">
|
||||
<item big="yes" weight="5000" score="10" capacity="7000" animal="yes">
|
||||
<construction skill="training" minskill="1" reqsize="1"/>
|
||||
<function name="give" value="givehorses"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<function name="produce" value="lua_produceresource"/>
|
||||
<function name="limit" value="lua_limitresource"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<resource name="seaserpenthead">
|
||||
<item weight="500" score="400"/>
|
||||
</resource>
|
||||
|
||||
<resource name="dragonblood">
|
||||
<item weight="100" score="100"/>
|
||||
</resource>
|
||||
|
||||
<resource name="dragonhead">
|
||||
<item weight="500" score="300"/>
|
||||
</resource>
|
||||
|
||||
<resource name="seed" limited="yes">
|
||||
<item weight="10" score="50"/>
|
||||
</resource>
|
||||
|
||||
<resource name="mallornseed" limited="yes">
|
||||
<item weight="10" score="100"/>
|
||||
</resource>
|
||||
|
||||
<resource name="log">
|
||||
<item weight="500" score="10">
|
||||
<construction skill="forestry" minskill="1" reqsize="1"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<modifier building="sawmill" type="skill" value="1"/>
|
||||
<modifier building="sawmill" type="material" value="0.5"/>
|
||||
<guard flag="logging"/>
|
||||
<function name="produce" value="lua_produceresource"/>
|
||||
<function name="limit" value="lua_limitresource"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<resource name="mallorn">
|
||||
<item weight="500" score="30">
|
||||
<construction skill="forestry" minskill="2" reqsize="1"/>
|
||||
</item>
|
||||
<resourcelimit>
|
||||
<modifier building="sawmill" type="skill" value="1"/>
|
||||
<modifier building="sawmill" type="material" value="0.5"/>
|
||||
<guard flag="logging"/>
|
||||
<function name="produce" value="lua_produceresource"/>
|
||||
<function name="limit" value="lua_limitresource"/>
|
||||
</resourcelimit>
|
||||
</resource>
|
||||
|
||||
<!-- luxury items -->
|
||||
<resource name="balm">
|
||||
<item weight="200"><luxury price="4"/></item>
|
||||
</resource>
|
||||
<resource name="spice">
|
||||
<item weight="200"><luxury price="5"/></item>
|
||||
</resource>
|
||||
<resource name="jewel">
|
||||
<item weight="100"><luxury price="7"/></item>
|
||||
</resource>
|
||||
<resource name="myrrh">
|
||||
<item weight="200"><luxury price="5"/></item>
|
||||
</resource>
|
||||
<resource name="oil">
|
||||
<item weight="300"><luxury price="3"/></item>
|
||||
</resource>
|
||||
<resource name="silk">
|
||||
<item weight="300"><luxury price="6"/></item>
|
||||
</resource>
|
||||
<resource name="incense">
|
||||
<item weight="200"><luxury price="4"/></item>
|
||||
</resource>
|
||||
|
||||
<!-- XE items -->
|
||||
<resource name="skillpotion">
|
||||
<!-- gives user one free learning attempt -->
|
||||
<item weight="0">
|
||||
<function name="use" value="use_skillpotion"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="manacrystal">
|
||||
<!-- gives user free aura -->
|
||||
<item weight="0">
|
||||
<function name="use" value="use_manacrystal"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<!-- xmas items -->
|
||||
<resource name="mistletoe">
|
||||
<!-- Sets the chance of escape in a fight to 100 percent -->
|
||||
<item notlost="yes" weight="0">
|
||||
<function name="use" value="usemistletoe"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="speedsail">
|
||||
<item weight="0">
|
||||
<function name="use" value="use_speedsail"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<!-- items -->
|
||||
<resource name="cart" big="true">
|
||||
<item capacity="14000" weight="4000" score="60" vehicle="yes">
|
||||
<construction skill="cartmaking" minskill="1" reqsize="1">
|
||||
<requirement type="log" quantity="5"/>
|
||||
</construction>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="antimagic" appearance="amulet">
|
||||
<item weight="0" score="2000">
|
||||
<function name="use" value="use_antimagiccrystal"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="wand_of_tears">
|
||||
<item notlost="yes" weight="0">
|
||||
<function name="use" value="use_wand_of_tears"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="mallornbow">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||
<requirement type="mallorn" quantity="1"/>
|
||||
</construction>
|
||||
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0" magres="0.15">
|
||||
<damage type="rider" value="1d11+2"/>
|
||||
<damage type="footman" value="1d11+2"/>
|
||||
<modifier type="missile_target" value="2"/>
|
||||
<modifier type="damage" value="1">
|
||||
<race name="elf"/>
|
||||
</modifier>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="laensword">
|
||||
<item weight="100" score="400">
|
||||
<construction skill="weaponsmithing" minskill="8" reqsize="1">
|
||||
<requirement type="laen" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="1" defmod="1" magres="0.30">
|
||||
<damage type="rider" value="3d6+10"/>
|
||||
<damage type="footman" value="3d6+10"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="rustygreatsword">
|
||||
<item weight="200" score="20">
|
||||
<construction skill="weaponsmithing" minskill="4" reqsize="1">
|
||||
<requirement type="iron" quantity="2"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="-2" defmod="-3">
|
||||
<damage type="rider" value="2d8"/>
|
||||
<damage type="footman" value="2d8"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="runesword">
|
||||
<item weight="100" score="2000">
|
||||
<weapon minskill="7" cut="true" magical="yes" skill="melee" offmod="2" defmod="2">
|
||||
<function name="attack" value="attack_firesword"/>
|
||||
<damage type="rider" value="3d10+10"/>
|
||||
<damage type="footman" value="3d10+10"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="firesword">
|
||||
<item weight="100">
|
||||
<weapon minskill="7" magres="0.3" cut="true" skill="melee" offmod="1" defmod="1">
|
||||
<function name="attack" value="attack_firesword"/>
|
||||
<damage type="rider" value="3d6+10"/>
|
||||
<damage type="footman" value="3d6+10"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="greatsword">
|
||||
<item weight="200" score="30">
|
||||
<construction skill="weaponsmithing" minskill="4" reqsize="1">
|
||||
<requirement type="iron" quantity="2"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="-1" defmod="-2">
|
||||
<damage type="rider" value="2d8+3"/>
|
||||
<damage type="footman" value="2d8+3"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="sword">
|
||||
<item weight="100" score="30">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee">
|
||||
<damage type="rider" value="1d9+2"/>
|
||||
<damage type="footman" value="1d9+2"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="greatbow">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||
<modifier function="mod_elves_only"/>
|
||||
<requirement type="mallorn" quantity="2"/>
|
||||
</construction>
|
||||
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0" magres="0.0">
|
||||
<damage type="rider" value="2d6+4"/>
|
||||
<damage type="footman" value="2d6+4"/>
|
||||
<modifier type="missile_target" value="2"/>
|
||||
<modifier type="damage" value="1">
|
||||
<race name="elf"/>
|
||||
</modifier>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="halberd">
|
||||
<item weight="200">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="log" quantity="2"/>
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="polearm" offmod="-1" defmod="2" magres="0.0">
|
||||
<damage type="rider" value="2d6+3"/>
|
||||
<damage type="footman" value="2d6+3"/>
|
||||
<modifier type="skill" value="1" walking="true" against_riding="true" defensive="true"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="peasant" pooled="false">
|
||||
<function name="change" value="lua_changeresource"/>
|
||||
<function name="get" value="lua_getresource"/>
|
||||
</resource>
|
||||
|
||||
<resource name="hp" pooled="false">
|
||||
<function name="change" value="lua_changeresource"/>
|
||||
<function name="get" value="lua_getresource"/>
|
||||
</resource>
|
||||
|
||||
<resource name="rustyhalberd">
|
||||
<item weight="200" score="20">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="iron" quantity="1"/>
|
||||
<requirement type="log" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="polearm" offmod="-2" defmod="-1">
|
||||
<damage type="rider" value="2d6"/>
|
||||
<damage type="footman" value="2d6"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="rustysword">
|
||||
<item weight="100" score="10">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="-1" defmod="-1">
|
||||
<damage type="rider" value="1d9"/>
|
||||
<damage type="footman" value="1d9"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="axe">
|
||||
<item weight="200">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="log" quantity="1"/>
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="1" defmod="-2">
|
||||
<damage type="rider" value="2d6+4"/>
|
||||
<damage type="footman" value="2d6+4"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="rustyaxe">
|
||||
<item weight="200">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="log" quantity="1"/>
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<weapon cut="true" skill="melee" offmod="0" defmod="-3">
|
||||
<damage type="rider" value="2d6"/>
|
||||
<damage type="footman" value="2d6"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="bow">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="2" reqsize="1">
|
||||
<requirement type="log" quantity="1"/>
|
||||
</construction>
|
||||
<weapon pierce="true" missile="true" skill="bow" offmod="0" defmod="0" reload="0">
|
||||
<damage type="rider" value="1d11+1"/>
|
||||
<damage type="footman" value="1d11+1"/>
|
||||
<modifier type="missile_target" value="2"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="catapult">
|
||||
<item weight="10000">
|
||||
<construction skill="cartmaking" minskill="5" reqsize="1">
|
||||
<requirement type="log" quantity="10"/>
|
||||
</construction>
|
||||
<weapon bash="true" missile="true" skill="catapult" offmod="0" defmod="0" reload="5">
|
||||
<damage type="rider" value="3d10+5"/>
|
||||
<damage type="footman" value="3d10+5"/>
|
||||
<modifier type="missile_target" value="4"/>
|
||||
<function name="attack" value="attack_catapult"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="crossbow">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="3" reqsize="1">
|
||||
<requirement type="log" quantity="1"/>
|
||||
</construction>
|
||||
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2">
|
||||
<damage type="rider" value="3d3+5"/>
|
||||
<damage type="footman" value="3d3+5"/>
|
||||
<modifier type="missile_target" value="2"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="mallorncrossbow">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||
<requirement type="mallorn" quantity="1"/>
|
||||
</construction>
|
||||
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2" magres="0.15">
|
||||
<damage type="rider" value="3d3+5"/>
|
||||
<damage type="footman" value="3d3+5"/>
|
||||
<modifier type="missile_target" value="2"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="spear">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="2" reqsize="1">
|
||||
<requirement type="log" quantity="1"/>
|
||||
</construction>
|
||||
<weapon pierce="true" skill="polearm" offmod="0" defmod="0">
|
||||
<damage type="footman" value="1d10"/>
|
||||
<damage type="rider" value="1d12+2"/>
|
||||
<modifier type="skill" value="1" riding="true" against_riding="true" against_walking="true" offensive="true"/>
|
||||
<modifier type="skill" value="1" walking="true" against_riding="true" against_walking="true" defensive="true"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="mallornspear">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||
<requirement type="mallorn" quantity="1"/>
|
||||
</construction>
|
||||
<weapon pierce="true" skill="polearm" minskill="5" offmod="0" defmod="0" magres="0.15">
|
||||
<damage type="footman" value="1d10+1"/>
|
||||
<damage type="rider" value="1d12+3"/>
|
||||
<modifier type="skill" value="1" riding="true" against_riding="true" against_walking="true" offensive="true"/>
|
||||
<modifier type="skill" value="1" walking="true" against_riding="true" against_walking="true" defensive="true"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="lance">
|
||||
<item weight="200">
|
||||
<construction skill="weaponsmithing" minskill="2" reqsize="1">
|
||||
<requirement type="log" quantity="2"/>
|
||||
</construction>
|
||||
<weapon pierce="true" skill="polearm" offmod="0" defmod="-2">
|
||||
<damage type="footman" value="1d5"/>
|
||||
<damage type="rider" value="2d6+5"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="mallornlance">
|
||||
<item weight="100">
|
||||
<construction skill="weaponsmithing" minskill="5" reqsize="1">
|
||||
<requirement type="mallorn" quantity="2"/>
|
||||
</construction>
|
||||
<weapon pierce="true" skill="polearm" minskill="5" offmod="0" defmod="0" magres="0.15">
|
||||
<damage type="footman" value="1d5+1"/>
|
||||
<damage type="rider" value="2d6+6"/>
|
||||
</weapon>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="catapultammo">
|
||||
<item weight="1000">
|
||||
<construction skill="quarrying" minskill="3" reqsize="1">
|
||||
<requirement type="stone" quantity="1"/>
|
||||
</construction>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="laenshield">
|
||||
<item weight="0" score="1000">
|
||||
<construction skill="armorer" minskill="7" reqsize="1">
|
||||
<requirement type="laen" quantity="1"/>
|
||||
</construction>
|
||||
<armor ac="2" penalty="-0.25" magres="0.3" laen="yes" shield="yes" />
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="laenmail">
|
||||
<item weight="100" score="1000">
|
||||
<construction skill="armorer" minskill="9" reqsize="1">
|
||||
<requirement type="laen" quantity="3"/>
|
||||
</construction>
|
||||
<armor ac="6" penalty="0.0" magres="0.3" laen="yes" />
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="rustyshield">
|
||||
<item weight="100" score="10">
|
||||
<construction skill="armorer" minskill="2" reqsize="1">
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<armor ac="1" penalty="0.0" magres="0.0" shield="yes"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="rustychainmail">
|
||||
<item weight="200" score="30">
|
||||
<construction skill="armorer" minskill="3" reqsize="1">
|
||||
<requirement type="iron" quantity="3"/>
|
||||
</construction>
|
||||
<armor ac="2" penalty="0.30" magres="0.0"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="shield">
|
||||
<item weight="100" score="30">
|
||||
<construction skill="armorer" minskill="2" reqsize="1">
|
||||
<requirement type="iron" quantity="1"/>
|
||||
</construction>
|
||||
<armor ac="1" penalty="-0.15" magres="0.0" shield="yes"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="chainmail">
|
||||
<item weight="200" score="90">
|
||||
<construction skill="armorer" minskill="3" reqsize="1">
|
||||
<requirement type="iron" quantity="3"/>
|
||||
</construction>
|
||||
<armor ac="3" penalty="0.15" magres="0.0"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="plate">
|
||||
<item weight="400" score="150">
|
||||
<construction skill="armorer" minskill="4" reqsize="1">
|
||||
<requirement type="iron" quantity="5"/>
|
||||
</construction>
|
||||
<armor ac="5" penalty="0.30" magres="0.0"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="toadslime" appearance="vial">
|
||||
<item weight="100" score="0"/>
|
||||
</resource>
|
||||
|
||||
</resources>
|
1342
src/res/asgard/races.xml
Normal file
1342
src/res/asgard/races.xml
Normal file
File diff suppressed because it is too large
Load diff
4
src/res/asgard/rules.xml
Normal file
4
src/res/asgard/rules.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<rules>
|
||||
<function name="wage" value="lua_wage"/>
|
||||
</rules>
|
57
src/res/asgard/terrains.xml
Normal file
57
src/res/asgard/terrains.xml
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<terrains>
|
||||
<!-- defaults: walk="yes" sail="yes" fly="yes" shallow="yes" swim="no" forest="no" sea="no" land="yes" forbidden="no" arctic="no" cavalry="no" -->
|
||||
<terrain name="ocean" size="100" shallow="no" walk="no" swim="yes" land="no" sea="yes" />
|
||||
<terrain name="plain" size="10000" road="50" shallow="no" 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="2000" 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="500" 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="4000" 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="1000" 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="100" 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="100" 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="100" 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" 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>
|
81
src/scripts/asgard.lua
Normal file
81
src/scripts/asgard.lua
Normal file
|
@ -0,0 +1,81 @@
|
|||
-- the locales that this gameworld supports.
|
||||
local locales = { "de", "en" }
|
||||
|
||||
function loadscript(name)
|
||||
local script = scriptpath .. "/" .. name
|
||||
print("- loading " .. script)
|
||||
if pcall(dofile, script)==0 then
|
||||
print("Could not load " .. script)
|
||||
end
|
||||
end
|
||||
|
||||
loadscript("default.lua")
|
||||
|
||||
function load_scripts()
|
||||
scripts = {
|
||||
"asgard/extensions.lua"
|
||||
}
|
||||
for index, value in pairs(scripts) do
|
||||
loadscript(value)
|
||||
end
|
||||
end
|
||||
|
||||
function process(orders)
|
||||
-- initialize starting equipment for new players
|
||||
|
||||
if open_game(get_turn())~=0 then
|
||||
print("could not read game")
|
||||
return -1
|
||||
end
|
||||
init_summary()
|
||||
|
||||
-- kill multi-players (external script)
|
||||
-- loadscript("eressea/multis.lua")
|
||||
|
||||
-- run the turn:
|
||||
-- set_encoding("utf8")
|
||||
if read_orders(orders) ~= 0 then
|
||||
print("could not read " .. orders)
|
||||
return -1
|
||||
end
|
||||
|
||||
plan_monsters()
|
||||
|
||||
local nmrs = get_nmrs(1)
|
||||
if nmrs >= 80 then
|
||||
print("Shit. More than 80 factions with 1 NMR (" .. nmrs .. ")")
|
||||
write_summary()
|
||||
return -1
|
||||
end
|
||||
print (nmrs .. " Factions with 1 NMR")
|
||||
|
||||
process_orders()
|
||||
|
||||
-- post-turn updates:
|
||||
update_guards()
|
||||
update_scores()
|
||||
|
||||
-- use newfactions file to place out new players
|
||||
autoseed(basepath .. "/newfactions", false)
|
||||
|
||||
write_files(locales)
|
||||
|
||||
file = "" .. get_turn() .. ".dat"
|
||||
if write_game(file, "binary")~=0 then
|
||||
print("could not write game")
|
||||
return -1
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- main body of script
|
||||
--
|
||||
|
||||
-- orderfile: contains the name of the orders.
|
||||
load_scripts()
|
||||
if orderfile==nil then
|
||||
print "you must specify an orderfile"
|
||||
else
|
||||
process(orderfile)
|
||||
end
|
||||
|
94
src/scripts/asgard/extensions.lua
Normal file
94
src/scripts/asgard/extensions.lua
Normal file
|
@ -0,0 +1,94 @@
|
|||
-- wage per person in this region
|
||||
function wage(r, f, race)
|
||||
return 10
|
||||
end
|
||||
|
||||
function peasant_getresource(u)
|
||||
return u.region:get_resource("peasant")
|
||||
end
|
||||
|
||||
function peasant_changeresource(u, delta)
|
||||
local p = u.region:get_resource("peasant")
|
||||
p = p + delta
|
||||
if p < 0 then
|
||||
p = 0
|
||||
end
|
||||
u.region:set_resource("peasant", p)
|
||||
return p
|
||||
end
|
||||
|
||||
function hp_getresource(u)
|
||||
return u.hp
|
||||
end
|
||||
|
||||
function hp_changeresource(u, delta)
|
||||
local hp = u.hp + delta
|
||||
|
||||
if hp < u.number then
|
||||
if hp < 0 then
|
||||
hp = 0
|
||||
end
|
||||
u.number = hp
|
||||
end
|
||||
u.hp = hp
|
||||
return hp
|
||||
end
|
||||
|
||||
function horse_limit(r)
|
||||
return r:get_resource("horse")
|
||||
end
|
||||
|
||||
function horse_produce(r, n)
|
||||
local horses = r:get_resource("horse")
|
||||
if horses>=n then
|
||||
r:set_resource("horse", horses-n)
|
||||
else
|
||||
r:set_resource("horse", 0)
|
||||
end
|
||||
end
|
||||
|
||||
function log_limit(r)
|
||||
if r:get_flag(1) then -- RF_MALLORN
|
||||
return 0
|
||||
end
|
||||
return r:get_resource("tree") + r:get_resource("sapling")
|
||||
end
|
||||
|
||||
function log_produce(r, n)
|
||||
local trees = r:get_resource("tree")
|
||||
if trees>=n then
|
||||
r:set_resource("tree", trees-n)
|
||||
else
|
||||
r:set_resource("tree", 0)
|
||||
n = n - trees
|
||||
trees = r:get_resource("sapling")
|
||||
if trees>=n then
|
||||
r:set_resource("sapling", trees-n)
|
||||
else
|
||||
r:set_resource("sapling", 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function mallorn_limit(r)
|
||||
if not r:get_flag(1) then -- RF_MALLORN
|
||||
return 0
|
||||
end
|
||||
return r:get_resource("tree") + r:get_resource("sapling")
|
||||
end
|
||||
|
||||
function mallorn_produce(r, n)
|
||||
local trees = r:get_resource("tree")
|
||||
if trees>=n then
|
||||
r:set_resource("tree", trees-n)
|
||||
else
|
||||
r:set_resource("tree", 0)
|
||||
n = n - trees
|
||||
trees = r:get_resource("sapling")
|
||||
if trees>=n then
|
||||
r:set_resource("sapling", trees-n)
|
||||
else
|
||||
r:set_resource("sapling", 0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
function get_wage(r, f, race)
|
||||
function wage(r, f, race)
|
||||
return 10
|
||||
end
|
||||
|
||||
|
||||
function get_maintenance(u)
|
||||
function maintenance(u)
|
||||
local f = u.region.owner
|
||||
if f ~= nil then
|
||||
if f == u.faction then
|
||||
|
@ -14,6 +14,3 @@ function get_maintenance(u)
|
|||
end
|
||||
return 10 * u.number
|
||||
end
|
||||
|
||||
overload("maintenance", get_maintenance)
|
||||
overload("wage", get_wage)
|
||||
|
|
Loading…
Reference in a new issue