spoils die 2.

This commit is contained in:
Katja Zedel 2002-05-05 18:41:15 +00:00
parent 7c9c5ebeae
commit b23529f731
5 changed files with 139 additions and 8 deletions

View File

@ -31,7 +31,7 @@ resource_type rt_elfspoil = {
&res_changeitem
};
item_type it_elfspoil = {
item_type it_elvenspoil = {
&rt_elfspoil, /* resourcetype */
0, 1, 0, /* flags, weight, capacity */
NULL, /* construction */

View File

@ -3257,3 +3257,4 @@ spell_name(const struct spell * sp, const struct locale * lang)
}
return sp->sname;
}

View File

@ -41,6 +41,10 @@
#include "karma.h"
#include "group.h"
/* item includes */
#include <items/racespoils.h>
/* util includes */
#include <attrib.h>
#include <functions.h>
@ -525,6 +529,105 @@ dragon_drops(const struct race * rc, int size)
}
return itm;
}
static item *
elf_spoil(const struct race * rc, int size)
{
item * itm = NULL;
if (rand()%100 < RACESPOILCHANCE){
i_add(&itm, i_new(&it_elvenspoil, size));
}
return itm;
}
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;
}
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));
}
return itm;
}
int
rc_specialdamage(const race * ar, const race * dr, const struct weapon_type * wtype)
@ -781,20 +884,26 @@ static xml_callbacks xml_races = {
tagbegin, tagend, NULL
};
/* Die Funktionen werden über den hier registrierten Namen in races.xml
* in die jeweilige Rassendefiniton eingebunden */
void
register_races(void)
{
char zBuffer[MAX_PATH];
/* init_familiar functions */
/* function initfamiliar */
register_function((pf_generic)oldfamiliars, "oldfamiliars");
/* move_allowed functions */
/* function move
* into which regiontyp moving is allowed for this race
* race->move_allowed() */
register_function((pf_generic)allowed_swim, "moveswimming");
register_function((pf_generic)allowed_walk, "movewalking");
register_function((pf_generic)allowed_fly, "moveflying");
register_function((pf_generic)allowed_dragon, "movedragon");
/* generate_name functions */
/* function name
* generate a name for a nonplayerunit
* race->generate_name() */
register_function((pf_generic)untoten_name, "nameundead");
register_function((pf_generic)skeleton_name, "nameskeleton");
register_function((pf_generic)zombie_name, "namezombie");
@ -803,7 +912,8 @@ register_races(void)
register_function((pf_generic)dracoid_name, "namedracoid");
register_function((pf_generic)shadow_name, "nameshadow");
/* aging functions */
/* function age
* race->age() */
register_function((pf_generic)age_undead, "ageundead");
register_function((pf_generic)age_illusion, "ageillusion");
register_function((pf_generic)age_skeleton, "ageskeleton");
@ -812,9 +922,22 @@ register_races(void)
register_function((pf_generic)age_dragon, "agedragon");
register_function((pf_generic)age_firedragon, "agefiredragon");
/* itemdrop functions */
/* function itemdrop
* to generate battle spoils
* race->itemdrop() */
register_function((pf_generic)dragon_drops, "dragondrops");
sprintf(zBuffer, "%s/races.xml", resourcepath());
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");
sprintf(zBuffer, "%s/races.xml", resourcepath());
xml_register(&xml_races, "eressea races", 0);
}

View File

@ -35,6 +35,8 @@
#define GOLEM_IRON 4 /* Anzahl Eisen in einem Eisengolem */
#define GOLEM_STONE 4 /* Anzahl Steine in einem Steingolem */
#define RACESPOILCHANCE 5 /* Chance auf rassentypische Beute */
typedef struct att {
int type;
union {

View File

@ -965,6 +965,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" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="-2" attackmodifier="0" defensemodifier="0" playerrace walk giveitem giveperson giveunit getitem equipment>
<ai splitsize="10000" attackrandom moverandom learn></ai>
<function name="itemdrop" value="halflingspoil"></function>
<skill name="sk_crossbow" modifier="1"></skill>
<skill name="sk_mining" modifier="1"></skill>
<skill name="sk_bow" modifier="-1"></skill>
@ -1025,6 +1026,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" attackmodifier="0" defensemodifier="0" playerrace walk shapeshift giveitem giveperson giveunit getitem recruitethereal equipment>
<ai splitsize="10000" attackrandom moverandom learn></ai>
<function name="initfamiliar" value="oldfamiliars"></function>
<function name="itemdrop" value="demonspoil"></function>
<skill name="sk_alchemy" modifier="2"></skill>
<skill name="sk_trade" modifier="-3"></skill>
<skill name="sk_forestry" modifier="1"></skill>
@ -1101,6 +1103,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" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="0" attackmodifier="0" defensemodifier="0" playerrace walk giveitem giveperson giveunit getitem equipment>
<ai splitsize="10000" attackrandom moverandom learn></ai>
<function name="initfamiliar" value="oldfamiliars"></function>
<function name="itemdrop" value="goblinspoil"></function>
<skill name="sk_alchemy" modifier="1"></skill>
<skill name="sk_mining" modifier="1"></skill>
<skill name="sk_building" modifier="1"></skill>
@ -1184,6 +1187,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" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="-2" attackmodifier="0" defensemodifier="0" playerrace walk giveitem giveperson giveunit getitem equipment>
<ai splitsize="10000" attackrandom moverandom learn></ai>
<function name="itemdrop" value="elfspoil"></function>
<skill name="sk_alchemy" modifier="-1"></skill>
<skill name="sk_mining" modifier="-2"></skill>
<skill name="sk_bow" modifier="2"></skill>
@ -1210,6 +1214,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" ac="0" damage="1d5" unarmedattack="-2" unarmeddefense="-2" attackmodifier="0" defensemodifier="0" playerrace walk giveitem giveperson giveunit getitem equipment>
<ai splitsize="10000" attackrandom moverandom learn></ai>
<function name="itemdrop" value="dwarfspoil"></function>
<skill name="sk_mining" modifier="2"></skill>
<skill name="sk_bow" modifier="-1"></skill>
<skill name="sk_building" modifier="2"></skill>