forked from github/server
scores are now an optional module.
spoils are moved to the XMl data, and the racespoils functions are greatly reduced (less LOC -> less bugs). phoenix feather is a wdw-only item
This commit is contained in:
parent
a6a98faebd
commit
62a51a8bf0
23 changed files with 146 additions and 488 deletions
|
@ -1092,10 +1092,12 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
|
|||
building *b;
|
||||
ship *sh;
|
||||
unit *u;
|
||||
int score = 0, avgscore = 0;
|
||||
const char * mailto = locale_string(f->locale, "mailto");
|
||||
region * first = firstregion(f), * last = lastregion(f);
|
||||
const attrib * a;
|
||||
#ifdef SCORE_MODULE
|
||||
int score = 0, avgscore = 0;
|
||||
#endif
|
||||
|
||||
/* must call this to get all the neighbour regions */
|
||||
get_seen_interval(seen, &first, &last);
|
||||
|
@ -1119,13 +1121,15 @@ report_computer(FILE * F, faction * f, struct seen_region ** seen, const faction
|
|||
fprintf(F, "PARTEI %d\n", f->no);
|
||||
fprintf(F, "\"%s\";locale\n", locale_name(f->locale));
|
||||
fprintf(F, "%d;Optionen\n", f->options);
|
||||
#ifdef SCORE_MODULE
|
||||
if (f->options & want(O_SCORE) && f->age>DISPLAYSCORE) {
|
||||
score = f->score;
|
||||
avgscore = average_score_of_age(f->age, f->age / 24 + 1);
|
||||
}
|
||||
fprintf(F, "%d;Punkte\n", score);
|
||||
fprintf(F, "%d;Punktedurchschnitt\n", avgscore);
|
||||
{
|
||||
#endif
|
||||
{
|
||||
const char * zRace = rc_name(f->race, 1);
|
||||
fprintf(F, "\"%s\";Typ\n", add_translation(zRace, LOC(f->locale, zRace)));
|
||||
}
|
||||
|
|
|
@ -1992,10 +1992,12 @@ report(FILE *F, faction * f, struct seen_region ** seen, const faction_list * ad
|
|||
}
|
||||
}
|
||||
rnl(F);
|
||||
#ifdef SCORE_MODULE
|
||||
if (f->options & want(O_SCORE) && f->age > DISPLAYSCORE) {
|
||||
RENDER(f, buf, sizeof(buf), ("nr_score", "score average", f->score, average_score_of_age(f->age, f->age / 24 + 1)));
|
||||
centre(F, buf, true);
|
||||
}
|
||||
#endif
|
||||
m = msg_message("nr_population", "population units", count_all(f), f->no_units);
|
||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
msg_release(m);
|
||||
|
|
|
@ -182,9 +182,6 @@
|
|||
<File
|
||||
RelativePath=".\itemtypes.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\racespoils.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\seed.h">
|
||||
</File>
|
||||
|
@ -204,9 +201,6 @@
|
|||
<File
|
||||
RelativePath=".\itemtypes.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\racespoils.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\seed.c">
|
||||
</File>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "xerewards.h"
|
||||
#include "artrewards.h"
|
||||
#include "weapons.h"
|
||||
#include "racespoils.h"
|
||||
#if GROWING_TREES
|
||||
# include "seed.h"
|
||||
#endif
|
||||
|
@ -33,7 +32,6 @@ register_itemtypes(void)
|
|||
register_seed();
|
||||
register_mallornseed();
|
||||
#endif
|
||||
register_racespoils();
|
||||
register_artrewards();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,223 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea-pbem.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <eressea.h>
|
||||
|
||||
#include "racespoils.h"
|
||||
|
||||
#include <build.h>
|
||||
#include <region.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <item.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
|
||||
resource_type rt_elfspoil = {
|
||||
{ "elfspoil", "elfspoil_p" },
|
||||
{ "elfspoil", "elfspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_elfspoil = {
|
||||
&rt_elfspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_demonspoil = {
|
||||
{ "demonspoil", "demonspoil_p" },
|
||||
{ "demonspoil", "demonspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_demonspoil = {
|
||||
&rt_demonspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_goblinspoil = {
|
||||
{ "goblinspoil", "goblinspoil_p" },
|
||||
{ "goblinspoil", "goblinspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_goblinspoil = {
|
||||
&rt_goblinspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_dwarfspoil = {
|
||||
{ "dwarfspoil", "dwarfspoil_p" },
|
||||
{ "dwarfspoil", "dwarfspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_dwarfspoil = {
|
||||
&rt_dwarfspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_halflingspoil = {
|
||||
{ "halflingspoil", "halflingspoil_p" },
|
||||
{ "halflingspoil", "halflingspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_halflingspoil = {
|
||||
&rt_halflingspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_humanspoil = {
|
||||
{ "humanspoil", "humanspoil_p" },
|
||||
{ "humanspoil", "humanspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_humanspoil = {
|
||||
&rt_humanspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_aquarianspoil = {
|
||||
{ "aquarianspoil", "aquarianspoil_p" },
|
||||
{ "aquarianspoil", "aquarianspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_aquarianspoil = {
|
||||
&rt_aquarianspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_insectspoil = {
|
||||
{ "insectspoil", "insectspoil_p" },
|
||||
{ "insectspoil", "insectspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_insectspoil = {
|
||||
&rt_insectspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_catspoil = {
|
||||
{ "catspoil", "catspoil_p" },
|
||||
{ "catspoil", "catspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_catspoil = {
|
||||
&rt_catspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_orcspoil = {
|
||||
{ "orcspoil", "orcspoil_p" },
|
||||
{ "orcspoil", "orcspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_orcspoil = {
|
||||
&rt_orcspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_trollspoil = {
|
||||
{ "trollspoil", "trollspoil_p" },
|
||||
{ "trollspoil", "trollspoil_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_trollspoil = {
|
||||
&rt_trollspoil, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
resource_type rt_phoenixfeather = {
|
||||
{ "phoenixfeather", "phoenixfeather_p" },
|
||||
{ "phoenixfeather", "phoenixfeather_p" },
|
||||
RTF_ITEM|RTF_POOLED,
|
||||
&res_changeitem
|
||||
};
|
||||
|
||||
item_type it_phoenixfeather = {
|
||||
&rt_phoenixfeather, /* resourcetype */
|
||||
0, 1, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* use */
|
||||
NULL /* give */
|
||||
};
|
||||
|
||||
void
|
||||
register_racespoils(void)
|
||||
{
|
||||
it_register(&it_elfspoil);
|
||||
it_register(&it_demonspoil);
|
||||
it_register(&it_goblinspoil);
|
||||
it_register(&it_dwarfspoil);
|
||||
it_register(&it_halflingspoil);
|
||||
it_register(&it_humanspoil);
|
||||
it_register(&it_aquarianspoil);
|
||||
it_register(&it_insectspoil);
|
||||
it_register(&it_catspoil);
|
||||
it_register(&it_orcspoil);
|
||||
it_register(&it_trollspoil);
|
||||
it_register(&it_phoenixfeather);
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea-pbem.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_ITM_SPOILS
|
||||
#define H_ITM_SPOILS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct item_type it_elfspoil;
|
||||
extern struct item_type it_demonspoil;
|
||||
extern struct item_type it_goblinspoil;
|
||||
extern struct item_type it_dwarfspoil;
|
||||
extern struct item_type it_halflingspoil;
|
||||
extern struct item_type it_humanspoil;
|
||||
extern struct item_type it_aquarianspoil;
|
||||
extern struct item_type it_insectspoil;
|
||||
extern struct item_type it_catspoil;
|
||||
extern struct item_type it_orcspoil;
|
||||
extern struct item_type it_trollspoil;
|
||||
extern struct item_type it_phoenixfeather;
|
||||
|
||||
extern void register_racespoils(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -85,7 +85,9 @@ typedef struct faction {
|
|||
boolean alive; /* enno: sollte ein flag werden */
|
||||
int nregions;
|
||||
int money;
|
||||
int score;
|
||||
#ifdef SCORE_MODULE
|
||||
int score;
|
||||
#endif
|
||||
struct alliance * alliance;
|
||||
#ifdef VICTORY_DELAY
|
||||
unsigned char victory_delay;
|
||||
|
|
|
@ -2131,6 +2131,82 @@ static const char * names[] = {
|
|||
"unit", "unit_p"
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
item_score(item_t i)
|
||||
{
|
||||
const luxury_type * ltype;
|
||||
|
||||
switch (i) {
|
||||
case I_IRON:
|
||||
case I_WOOD:
|
||||
case I_STONE:
|
||||
case I_HORSE:
|
||||
return 10;
|
||||
case I_MALLORN:
|
||||
return 30;
|
||||
case I_LAEN:
|
||||
return 100;
|
||||
case I_WAGON:
|
||||
return 60;
|
||||
case I_SHIELD:
|
||||
return 30;
|
||||
case I_LAENSHIELD:
|
||||
case I_LAENSWORD:
|
||||
return 400;
|
||||
case I_LAENCHAIN:
|
||||
return 1000;
|
||||
case I_CHAIN_MAIL:
|
||||
return 40;
|
||||
case I_PLATE_ARMOR:
|
||||
return 60;
|
||||
case I_BALM:
|
||||
case I_SPICES:
|
||||
case I_JEWELERY:
|
||||
case I_MYRRH:
|
||||
case I_OIL:
|
||||
case I_SILK:
|
||||
case I_INCENSE:
|
||||
ltype = resource2luxury(olditemtype[i]->rtype);
|
||||
if (ltype) return ltype->price / 5;
|
||||
return 0;
|
||||
case I_AMULET_OF_HEALING:
|
||||
case I_AMULET_OF_TRUE_SEEING:
|
||||
case I_RING_OF_INVISIBILITY:
|
||||
case I_RING_OF_POWER:
|
||||
case I_CHASTITY_BELT:
|
||||
case I_TROLLBELT:
|
||||
case I_RING_OF_NIMBLEFINGER:
|
||||
case I_FEENSTIEFEL:
|
||||
return 6000;
|
||||
case I_ANTIMAGICCRYSTAL:
|
||||
return 2000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
init_oldscores(void)
|
||||
{
|
||||
item_t i;
|
||||
|
||||
for (i = 0;olditemtype[i];i++) {
|
||||
item_type * itype = olditemtype[i];
|
||||
|
||||
if (itype->flags & ITF_WEAPON) {
|
||||
int m;
|
||||
if (itype->construction->materials==NULL) {
|
||||
itype->score = 6000;
|
||||
} else for (m=0;itype->construction->materials[m].number;++m) {
|
||||
const resource_type * rtype = oldresourcetype[itype->construction->materials[m].type];
|
||||
int score = rtype->itype?rtype->itype->score:5;
|
||||
itype->score += 2*itype->construction->materials[m].number * score;
|
||||
}
|
||||
}
|
||||
else itype->score = item_score(i);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
init_resources(void)
|
||||
{
|
||||
|
@ -2168,6 +2244,7 @@ init_resources(void)
|
|||
init_olditems();
|
||||
init_oldherbs();
|
||||
init_oldpotions();
|
||||
init_oldscores();
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -117,6 +117,9 @@ typedef struct item_type {
|
|||
int (*use)(struct unit * user, const struct item_type * itype, int amount, struct order * ord);
|
||||
int (*useonother)(struct unit * user, int targetno, const struct item_type * itype, int amount, struct order * ord);
|
||||
boolean (*give)(const struct unit * src, const struct unit * dest, const struct item_type * itm, int number, struct order * ord);
|
||||
#ifdef SCORE_MODULE
|
||||
int score;
|
||||
#endif
|
||||
struct item_type * next;
|
||||
} item_type;
|
||||
|
||||
|
|
|
@ -41,10 +41,6 @@
|
|||
#include "karma.h"
|
||||
#include "group.h"
|
||||
|
||||
/* item includes */
|
||||
#include <items/racespoils.h>
|
||||
|
||||
|
||||
/* util includes */
|
||||
#include <attrib.h>
|
||||
#include <functions.h>
|
||||
|
@ -509,109 +505,26 @@ dragon_drops(const struct race * rc, int size)
|
|||
static item *
|
||||
phoenix_drops(const struct race *rc, int size)
|
||||
{
|
||||
const item_type * it_phoenixfeather = it_find("phoenixfeather");
|
||||
item *itm = NULL;
|
||||
i_add(&itm, i_new(&it_phoenixfeather, size));
|
||||
if (it_phoenixfeather!=NULL) i_add(&itm, i_new(it_phoenixfeather, size));
|
||||
return itm;
|
||||
}
|
||||
|
||||
static item *
|
||||
elf_spoil(const struct race * rc, int size)
|
||||
default_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_elfspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
item * itm = NULL;
|
||||
|
||||
static item *
|
||||
demon_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_demonspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
if (rand()%100 < RACESPOILCHANCE) {
|
||||
char spoilname[32];
|
||||
const item_type * itype;
|
||||
|
||||
static item *
|
||||
goblin_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_goblinspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
dwarf_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_dwarfspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
halfling_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_halflingspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
human_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_humanspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
aquarian_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_aquarianspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
insect_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_insectspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
cat_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_catspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
orc_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_orcspoil, size));
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
static item *
|
||||
troll_spoil(const struct race * rc, int size)
|
||||
{
|
||||
item * itm = NULL;
|
||||
if (rand()%100 < RACESPOILCHANCE){
|
||||
i_add(&itm, i_new(&it_trollspoil, size));
|
||||
sprintf(spoilname, "%sspoil", rc->_name[0]);
|
||||
itype = it_find(spoilname);
|
||||
if (itype!=NULL) {
|
||||
i_add(&itm, i_new(itype, size));
|
||||
}
|
||||
}
|
||||
return itm;
|
||||
}
|
||||
|
@ -722,17 +635,7 @@ register_races(void)
|
|||
* race->itemdrop() */
|
||||
register_function((pf_generic)dragon_drops, "dragondrops");
|
||||
register_function((pf_generic)phoenix_drops, "phoenixdrops");
|
||||
register_function((pf_generic)elf_spoil, "elfspoil");
|
||||
register_function((pf_generic)demon_spoil, "demonspoil");
|
||||
register_function((pf_generic)goblin_spoil, "goblinspoil");
|
||||
register_function((pf_generic)dwarf_spoil, "dwarfspoil");
|
||||
register_function((pf_generic)halfling_spoil, "halflingspoil");
|
||||
register_function((pf_generic)human_spoil, "humanspoil");
|
||||
register_function((pf_generic)aquarian_spoil, "aquarianspoil");
|
||||
register_function((pf_generic)insect_spoil, "insectspoil");
|
||||
register_function((pf_generic)cat_spoil, "catspoil");
|
||||
register_function((pf_generic)orc_spoil, "orcspoil");
|
||||
register_function((pf_generic)troll_spoil, "trollspoil");
|
||||
register_function((pf_generic)default_spoil, "defaultdrops");
|
||||
|
||||
sprintf(zBuffer, "%s/races.xml", resourcepath());
|
||||
}
|
||||
|
|
|
@ -661,6 +661,9 @@ xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
|
|||
if (xml_bvalue(node, "big", false)) flags |= ITF_BIG;
|
||||
if (xml_bvalue(node, "animal", false)) flags |= ITF_ANIMAL;
|
||||
itype = new_itemtype(rtype, flags, weight, capacity);
|
||||
#ifdef SCORE_MODULE
|
||||
itype->score = xml_ivalue(node, "score", 0);
|
||||
#endif
|
||||
|
||||
/* reading item/construction */
|
||||
xpath->node = node;
|
||||
|
|
|
@ -108,7 +108,7 @@ static resource_type rt_gryphonwing = {
|
|||
static item_type it_gryphonwing = {
|
||||
&rt_gryphonwing, /* resourcetype */
|
||||
ITF_NOTLOST|ITF_CURSED, 0, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* construction, score */
|
||||
&leave_arena,
|
||||
NULL,
|
||||
&give_igjarjuk
|
||||
|
@ -177,7 +177,7 @@ static resource_type rt_arenagate = {
|
|||
static item_type it_arenagate = {
|
||||
&rt_arenagate, /* resourcetype */
|
||||
ITF_NONE, 0, 0, /* flags, weight, capacity */
|
||||
NULL, /* construction */
|
||||
NULL, /* construction, score */
|
||||
&enter_arena
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <config.h>
|
||||
#include "eressea.h"
|
||||
#ifdef SCORE_MODULE
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/alliance.h>
|
||||
|
@ -42,87 +43,6 @@
|
|||
/* libc includes */
|
||||
#include <math.h>
|
||||
|
||||
static attrib_type at_score = {
|
||||
"score"
|
||||
};
|
||||
|
||||
static int
|
||||
item_score(item_t i)
|
||||
{
|
||||
const luxury_type * ltype;
|
||||
|
||||
switch (i) {
|
||||
case I_IRON:
|
||||
case I_WOOD:
|
||||
case I_STONE:
|
||||
case I_HORSE:
|
||||
return 10;
|
||||
case I_MALLORN:
|
||||
return 30;
|
||||
case I_LAEN:
|
||||
return 100;
|
||||
case I_WAGON:
|
||||
return 60;
|
||||
case I_SHIELD:
|
||||
return 30;
|
||||
case I_LAENSHIELD:
|
||||
case I_LAENSWORD:
|
||||
return 400;
|
||||
case I_LAENCHAIN:
|
||||
return 1000;
|
||||
case I_CHAIN_MAIL:
|
||||
return 40;
|
||||
case I_PLATE_ARMOR:
|
||||
return 60;
|
||||
case I_BALM:
|
||||
case I_SPICES:
|
||||
case I_JEWELERY:
|
||||
case I_MYRRH:
|
||||
case I_OIL:
|
||||
case I_SILK:
|
||||
case I_INCENSE:
|
||||
ltype = resource2luxury(olditemtype[i]->rtype);
|
||||
if (ltype) return ltype->price / 5;
|
||||
return 0;
|
||||
case I_AMULET_OF_HEALING:
|
||||
case I_AMULET_OF_TRUE_SEEING:
|
||||
case I_RING_OF_INVISIBILITY:
|
||||
case I_RING_OF_POWER:
|
||||
case I_CHASTITY_BELT:
|
||||
case I_TROLLBELT:
|
||||
case I_RING_OF_NIMBLEFINGER:
|
||||
case I_FEENSTIEFEL:
|
||||
return 6000;
|
||||
case I_ANTIMAGICCRYSTAL:
|
||||
return 2000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
init_scores(void)
|
||||
{
|
||||
item_t i;
|
||||
|
||||
for (i = 0;olditemtype[i];i++) {
|
||||
const item_type * itype = olditemtype[i];
|
||||
attrib * a = a_add(&itype->rtype->attribs, a_new(&at_score));
|
||||
|
||||
if (itype->flags & ITF_WEAPON) {
|
||||
int m;
|
||||
if (itype->construction->materials==NULL) {
|
||||
a->data.i = 6000;
|
||||
} else for (m=0;itype->construction->materials[m].number;++m) {
|
||||
const resource_type * rtype = oldresourcetype[itype->construction->materials[m].number];
|
||||
const attrib * ascore = a_findc(rtype->attribs, &at_score);
|
||||
int score = ascore?ascore->data.i:5;
|
||||
a->data.i += 2*itype->construction->materials[m].number * score;
|
||||
}
|
||||
}
|
||||
else a->data.i = item_score(i);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
average_score_of_age(int age, int a)
|
||||
{
|
||||
|
@ -153,12 +73,7 @@ score(void)
|
|||
ship *s;
|
||||
int allscores = 0;
|
||||
int c;
|
||||
static boolean init = false;
|
||||
|
||||
if (!init) {
|
||||
init=true;
|
||||
init_scores();
|
||||
}
|
||||
for (f = factions; f; f = f->next) f->score = 0;
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
|
@ -194,6 +109,7 @@ score(void)
|
|||
for (u = r->units; u; u = u->next) {
|
||||
char index;
|
||||
item * itm;
|
||||
int itemscore = 0;
|
||||
if (u->race == new_race[RC_SPELL] || u->race == new_race[RC_BIRTHDAYDRAGON])
|
||||
continue;
|
||||
|
||||
|
@ -204,9 +120,9 @@ score(void)
|
|||
}
|
||||
f->score += get_money(u) / 50;
|
||||
for (itm=u->items; itm; itm=itm->next) {
|
||||
attrib * a = a_find(itm->type->rtype->attribs, &at_score);
|
||||
if (a!=NULL) f->score += itm->number * a->data.i / 10;
|
||||
itemscore += itm->number * itm->type->score;
|
||||
}
|
||||
f->score += itemscore / 10;
|
||||
|
||||
for (index = 0; index != MAXSKILLS; index++) {
|
||||
switch (index) {
|
||||
|
@ -291,3 +207,4 @@ score(void)
|
|||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef SCORE_MODULE
|
||||
#error "must define SCORE_MODULE to use this module"
|
||||
#endif
|
||||
|
||||
|
||||
extern void score(void);
|
||||
extern int average_score_of_age(int age, int a);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#define MUSEUM_MODULE
|
||||
#define ARENA_MODULE
|
||||
#define SCORE_MODULE
|
||||
#define WORMHOLE_MODULE
|
||||
#define XECMD_MODULE
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
|
||||
#undef ALLIANCEJOIN
|
||||
|
||||
#define SCORE_MODULE
|
||||
#undef DUNGEON_MODULE
|
||||
#undef MUSEUM_MODULE
|
||||
#undef ARENA_MODULE
|
||||
|
|
|
@ -216,9 +216,6 @@
|
|||
<File
|
||||
RelativePath="..\modules\oceannames.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\modules\score.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\common\triggers\triggers.h">
|
||||
</File>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<xi:include href="en/strings.xml"/>
|
||||
|
||||
<xi:include href="resources.xml"/>
|
||||
<xi:include href="spoils.xml"/>
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<xi:include href="en/strings.xml"/>
|
||||
|
||||
<xi:include href="resources.xml"/>
|
||||
<xi:include href="spoils.xml"/>
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<xi:include href="en/strings.xml"/>
|
||||
|
||||
<xi:include href="resources.xml"/>
|
||||
<xi:include href="spoils.xml"/>
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
|
|
|
@ -725,7 +725,7 @@
|
|||
</race>
|
||||
<race name="aquarian" magres="0.000000" maxaura="1.000000" regaura="1.000000" recruitcost="80" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" coastal="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="aquarianspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_mining" modifier="-2"/>
|
||||
<skill name="sk_building" modifier="-1"/>
|
||||
<skill name="sk_trade" modifier="2"/>
|
||||
|
@ -744,7 +744,7 @@
|
|||
</race>
|
||||
<race name="cat" magres="0.000000" maxaura="1.000000" regaura="1.000000" recruitcost="90" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" defensemodifier="1" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="catspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="-1"/>
|
||||
<skill name="sk_mining" modifier="-2"/>
|
||||
<skill name="sk_building" modifier="-1"/>
|
||||
|
@ -770,7 +770,7 @@
|
|||
</race>
|
||||
<race name="halfling" magres="0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="80" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="18" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="halflingspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_crossbow" modifier="1"/>
|
||||
<skill name="sk_mining" modifier="1"/>
|
||||
<skill name="sk_bow" modifier="-1"/>
|
||||
|
@ -802,7 +802,7 @@
|
|||
</race>
|
||||
<race name="insect" magres="0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="80" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="24" ac="2" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="insectspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_crossbow" modifier="1"/>
|
||||
<skill name="sk_mining" modifier="1"/>
|
||||
<skill name="sk_bow" modifier="-2"/>
|
||||
|
@ -832,7 +832,7 @@
|
|||
<race name="demon" magres="0.150000" maxaura="1.000000" regaura="1.250000" recruitcost="150" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="50" ac="2" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" shapeshift="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" recruitethereal="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="initfamiliar" value="oldfamiliars"/>
|
||||
<function name="itemdrop" value="demonspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="2"/>
|
||||
<skill name="sk_trade" modifier="-3"/>
|
||||
<skill name="sk_forestry" modifier="1"/>
|
||||
|
@ -863,7 +863,7 @@
|
|||
</race>
|
||||
<race name="troll" magres="0.100000" maxaura="1.000000" regaura="1.000000" recruitcost="90" maintenance="10" weight="2000" capacity="1080" speed="1.000000" hp="30" ac="1" damage="1d5+3" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="trollspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_mining" modifier="2"/>
|
||||
<skill name="sk_bow" modifier="-2"/>
|
||||
<skill name="sk_building" modifier="2"/>
|
||||
|
@ -894,7 +894,7 @@
|
|||
</race>
|
||||
<race name="human" magres="0.000000" maxaura="1.000000" regaura="1.000000" recruitcost="75" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="20" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="humanspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_trade" modifier="1"/>
|
||||
<skill name="sk_herbalism" modifier="-1"/>
|
||||
<skill name="sk_shipcraft" modifier="1"/>
|
||||
|
@ -911,7 +911,7 @@
|
|||
<race name="goblin" magres="-0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="40" maintenance="10" weight="600" capacity="440" speed="1.000000" hp="16" damage="1d5" unarmedattack="-2" unarmeddefense="0" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="initfamiliar" value="oldfamiliars"/>
|
||||
<function name="itemdrop" value="goblinspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="1"/>
|
||||
<skill name="sk_mining" modifier="1"/>
|
||||
<skill name="sk_building" modifier="1"/>
|
||||
|
@ -1135,7 +1135,7 @@
|
|||
</race>
|
||||
<race name="snotling" magres="-0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="50" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="24" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="orcspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="1"/>
|
||||
<skill name="sk_mining" modifier="1"/>
|
||||
<skill name="sk_building" modifier="1"/>
|
||||
|
@ -1166,7 +1166,7 @@
|
|||
|
||||
<race name="orc" magres="-0.050000" maxaura="1.000000" regaura="1.000000" recruitcost="50" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="24" damage="1d5" unarmedattack="-2" unarmeddefense="-2" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="orcspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="1"/>
|
||||
<skill name="sk_mining" modifier="1"/>
|
||||
<skill name="sk_building" modifier="1"/>
|
||||
|
@ -1196,7 +1196,7 @@
|
|||
</race>
|
||||
<race name="elf" magres="0.100000" maxaura="1.000000" regaura="1.250000" recruitcost="130" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="18" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="elfspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_alchemy" modifier="-1"/>
|
||||
<skill name="sk_mining" modifier="-2"/>
|
||||
<skill name="sk_bow" modifier="2"/>
|
||||
|
@ -1223,7 +1223,7 @@
|
|||
</race>
|
||||
<race name="dwarf" magres="0.050000" maxaura="1.000000" regaura="0.500000" recruitcost="110" maintenance="10" weight="1000" capacity="540" speed="1.000000" hp="24" damage="1d5" unarmedattack="-2" unarmeddefense="-2" playerrace="yes" walk="yes" giveitem="yes" giveperson="yes" giveunit="yes" getitem="yes" equipment="yes">
|
||||
<ai splitsize="10000" moverandom="yes" learn="yes"/>
|
||||
<function name="itemdrop" value="dwarfspoil"/>
|
||||
<function name="itemdrop" value="defaultdrops"/>
|
||||
<skill name="sk_mining" modifier="2"/>
|
||||
<skill name="sk_bow" modifier="-1"/>
|
||||
<skill name="sk_building" modifier="2"/>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<xi:include file="fr/strings.xml"/>
|
||||
|
||||
<xi:include href="resources.xml"/>
|
||||
<xi:include href="spoils.xml"/>
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<xi:include href="en/strings.xml"/>
|
||||
|
||||
<xi:include href="resources.xml"/>
|
||||
<xi:include href="spoils.xml"/>
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="prefixes.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
|
@ -52,4 +53,12 @@
|
|||
<text locale="de">WDW BEFEHLE</text>
|
||||
</string>
|
||||
</strings>
|
||||
|
||||
<resources>
|
||||
<resource name="phoenixfeather">
|
||||
<function name="change" value="changeitem"/>
|
||||
<item weight="1"/>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</eressea>
|
||||
|
|
Loading…
Reference in a new issue