put spoils code into the open source parts of the code.

reduce number of races in Meropis
This commit is contained in:
Enno Rehling 2011-02-27 00:36:38 -08:00
parent 12c3324850
commit 2e547d6ae8
2 changed files with 21 additions and 2 deletions

View File

@ -21,7 +21,7 @@ end
local function two_factions() local function two_factions()
local f1 = faction.create("noreply@eressea.de", "human", "de") local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "orc", "de") local f2 = faction.create("noreply@eressea.de", "elf", "de")
return f1, f2 return f1, f2
end end
@ -266,7 +266,7 @@ function test_events()
plain = region.create(0, 0, "plain") plain = region.create(0, 0, "plain")
skill = 8 skill = 8
f = faction.create("noreply@eressea.de", "orc", "de") f = faction.create("noreply@eressea.de", "elf", "de")
f.age = 20 f.age = 20
u = unit.create(f, plain) u = unit.create(f, plain)

View File

@ -1155,6 +1155,24 @@ attrib_type at_resourcelimit = {
finalize_resourcelimit, finalize_resourcelimit,
}; };
static item *
default_spoil(const struct race * rc, int size)
{
item * itm = NULL;
if (rng_int()%100 < RACESPOILCHANCE) {
char spoilname[32];
const item_type * itype;
sprintf(spoilname, "%sspoil", rc->_name[0]);
itype = it_find(spoilname);
if (itype!=NULL) {
i_add(&itm, i_new(itype, size));
}
}
return itm;
}
void void
register_resources(void) register_resources(void)
{ {
@ -1166,6 +1184,7 @@ register_resources(void)
register_function((pf_generic)res_changepermaura, "changepermaura"); register_function((pf_generic)res_changepermaura, "changepermaura");
register_function((pf_generic)res_changehp, "changehp"); register_function((pf_generic)res_changehp, "changehp");
register_function((pf_generic)res_changeaura, "changeaura"); register_function((pf_generic)res_changeaura, "changeaura");
register_function((pf_generic)default_spoil, "defaultdrops");
register_item_use(use_potion, "usepotion"); register_item_use(use_potion, "usepotion");
register_item_use(use_potion_delayed, "usepotion_delayed"); register_item_use(use_potion_delayed, "usepotion_delayed");