2015-01-30 20:37:14 +01:00
|
|
|
|
/*
|
2010-08-08 09:40:42 +02:00
|
|
|
|
* +-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
|
|
|
* | | Enno Rehling <enno@eressea.de>
|
|
|
|
|
* | Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
|
|
|
|
* | (c) 1998 - 2007 |
|
|
|
|
|
* | | This program may not be used, modified or distributed
|
|
|
|
|
* +-------------------+ without prior permission by the authors of Eressea.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2014-03-15 19:29:11 +01:00
|
|
|
|
#include <platform.h>
|
2010-08-08 09:40:42 +02:00
|
|
|
|
#include <kernel/config.h>
|
|
|
|
|
#include "races.h"
|
|
|
|
|
|
|
|
|
|
#include <kernel/building.h>
|
|
|
|
|
#include <kernel/equipment.h>
|
|
|
|
|
#include <kernel/faction.h>
|
|
|
|
|
#include <kernel/item.h>
|
|
|
|
|
#include <kernel/pathfinder.h>
|
|
|
|
|
#include <kernel/race.h>
|
|
|
|
|
#include <kernel/region.h>
|
|
|
|
|
#include <kernel/ship.h>
|
|
|
|
|
#include <kernel/terrain.h>
|
|
|
|
|
#include <kernel/unit.h>
|
|
|
|
|
|
|
|
|
|
#include <util/attrib.h>
|
|
|
|
|
#include <util/functions.h>
|
|
|
|
|
#include <util/rng.h>
|
|
|
|
|
|
2014-03-15 19:29:11 +01:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
2010-08-08 09:40:42 +02:00
|
|
|
|
void age_firedragon(struct unit *u);
|
|
|
|
|
void age_dragon(struct unit *u);
|
|
|
|
|
void age_illusion(struct unit *u);
|
|
|
|
|
void age_undead(struct unit *u);
|
|
|
|
|
void age_skeleton(struct unit *u);
|
|
|
|
|
void age_zombie(struct unit *u);
|
|
|
|
|
void age_ghoul(struct unit *u);
|
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
|
static void oldfamiliars(unit * u)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
2015-01-30 20:37:14 +01:00
|
|
|
|
char fname[64];
|
|
|
|
|
/* these familiars have no special skills.
|
|
|
|
|
*/
|
|
|
|
|
_snprintf(fname, sizeof(fname), "%s_familiar", u_race(u)->_name);
|
|
|
|
|
create_mage(u, M_GRAY);
|
|
|
|
|
equip_unit(u, get_equipment(fname));
|
2010-08-08 09:40:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
|
static void equip_newunits(const struct equipment *eq, struct unit *u)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
2014-06-25 07:44:05 +02:00
|
|
|
|
struct region *r = u->region;
|
|
|
|
|
const struct resource_type *rtype;
|
|
|
|
|
switch (old_race(u_race(u))) {
|
|
|
|
|
case RC_ELF:
|
|
|
|
|
rtype = rt_find("fairyboot");
|
|
|
|
|
set_show_item(u->faction, rtype->itype);
|
|
|
|
|
break;
|
|
|
|
|
case RC_GOBLIN:
|
|
|
|
|
rtype = rt_find("roi");
|
|
|
|
|
set_show_item(u->faction, rtype->itype);
|
|
|
|
|
set_number(u, 10);
|
2015-01-30 20:37:14 +01:00
|
|
|
|
break;
|
2014-06-25 07:44:05 +02:00
|
|
|
|
case RC_HUMAN:
|
|
|
|
|
if (u->building == NULL) {
|
|
|
|
|
const building_type *btype = bt_find("castle");
|
|
|
|
|
if (btype != NULL) {
|
|
|
|
|
building *b = new_building(btype, r, u->faction->locale);
|
|
|
|
|
b->size = 10;
|
|
|
|
|
u_set_building(u, b);
|
|
|
|
|
building_set_owner(u);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case RC_CAT:
|
|
|
|
|
rtype = rt_find("roi");
|
|
|
|
|
set_show_item(u->faction, rtype->itype);
|
|
|
|
|
break;
|
|
|
|
|
case RC_AQUARIAN:
|
2015-01-30 20:37:14 +01:00
|
|
|
|
{
|
|
|
|
|
ship *sh = new_ship(st_find("boat"), r, u->faction->locale);
|
|
|
|
|
sh->size = sh->type->construction->maxsize;
|
|
|
|
|
u_set_ship(u, sh);
|
|
|
|
|
}
|
|
|
|
|
break;
|
2014-06-25 07:44:05 +02:00
|
|
|
|
case RC_CENTAUR:
|
|
|
|
|
rsethorses(r, 250 + rng_int() % 51 + rng_int() % 51);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2015-01-30 20:37:14 +01:00
|
|
|
|
}
|
2010-08-08 09:40:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Die Funktionen werden <20>ber den hier registrierten Namen in races.xml
|
|
|
|
|
* in die jeweilige Rassendefiniton eingebunden */
|
2011-03-07 08:03:10 +01:00
|
|
|
|
void register_races(void)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
2015-01-30 20:37:14 +01:00
|
|
|
|
/* function initfamiliar */
|
|
|
|
|
register_function((pf_generic)oldfamiliars, "oldfamiliars");
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
|
register_function((pf_generic)allowed_dragon, "movedragon");
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
|
register_function((pf_generic)allowed_swim, "moveswimming");
|
|
|
|
|
register_function((pf_generic)allowed_fly, "moveflying");
|
|
|
|
|
register_function((pf_generic)allowed_walk, "movewalking");
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
|
/* function age for race->age() */
|
|
|
|
|
register_function((pf_generic)age_undead, "ageundead");
|
|
|
|
|
register_function((pf_generic)age_illusion, "ageillusion");
|
|
|
|
|
register_function((pf_generic)age_skeleton, "ageskeleton");
|
|
|
|
|
register_function((pf_generic)age_zombie, "agezombie");
|
|
|
|
|
register_function((pf_generic)age_ghoul, "ageghoul");
|
|
|
|
|
register_function((pf_generic)age_dragon, "agedragon");
|
|
|
|
|
register_function((pf_generic)age_firedragon, "agefiredragon");
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
2015-01-30 20:37:14 +01:00
|
|
|
|
/* function itemdrop
|
|
|
|
|
* to generate battle spoils
|
|
|
|
|
* race->itemdrop() */
|
|
|
|
|
register_function((pf_generic)equip_newunits, "equip_newunits");
|
2010-08-08 09:40:42 +02:00
|
|
|
|
}
|