2010-08-08 10:06:34 +02:00
|
|
|
|
/*
|
2015-01-30 22:10:29 +01:00
|
|
|
|
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
2014-12-09 07:20:36 +01:00
|
|
|
|
Katja Zedel <katze@felidae.kn-bremen.de
|
|
|
|
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
#ifndef H_KRNL_RACE_H
|
|
|
|
|
#define H_KRNL_RACE_H
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#include "magic.h" /* wegen MAXMAGIETYP */
|
2014-06-21 08:59:04 +02:00
|
|
|
|
#include "skill.h"
|
2014-12-09 07:20:36 +01:00
|
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define AT_NONE 0
|
|
|
|
|
#define AT_STANDARD 1
|
|
|
|
|
#define AT_DRAIN_EXP 2
|
|
|
|
|
#define AT_DRAIN_ST 3
|
|
|
|
|
#define AT_NATURAL 4
|
|
|
|
|
#define AT_DAZZLE 5
|
|
|
|
|
#define AT_SPELL 6
|
|
|
|
|
#define AT_COMBATSPELL 7
|
|
|
|
|
#define AT_STRUCTURAL 8
|
|
|
|
|
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#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 */
|
|
|
|
|
|
2015-01-19 15:13:03 +01:00
|
|
|
|
#define RACE_ATTACKS 10 /* maximum number of attacks */
|
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
struct param;
|
|
|
|
|
struct spell;
|
|
|
|
|
|
2016-08-28 21:44:09 +02:00
|
|
|
|
extern int num_races;
|
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
typedef enum {
|
|
|
|
|
RC_DWARF, /* 0 - Zwerg */
|
|
|
|
|
RC_ELF,
|
|
|
|
|
RC_GOBLIN = 3,
|
|
|
|
|
RC_HUMAN,
|
|
|
|
|
|
|
|
|
|
RC_TROLL,
|
|
|
|
|
RC_DAEMON,
|
|
|
|
|
RC_INSECT,
|
|
|
|
|
RC_HALFLING,
|
|
|
|
|
RC_CAT,
|
|
|
|
|
|
|
|
|
|
RC_AQUARIAN,
|
|
|
|
|
RC_ORC,
|
|
|
|
|
RC_SNOTLING,
|
|
|
|
|
RC_UNDEAD,
|
|
|
|
|
RC_ILLUSION,
|
|
|
|
|
|
|
|
|
|
RC_FIREDRAGON,
|
|
|
|
|
RC_DRAGON,
|
|
|
|
|
RC_WYRM,
|
|
|
|
|
RC_TREEMAN,
|
|
|
|
|
RC_BIRTHDAYDRAGON,
|
|
|
|
|
|
|
|
|
|
RC_DRACOID,
|
|
|
|
|
RC_SPECIAL,
|
|
|
|
|
RC_SPELL,
|
|
|
|
|
RC_IRONGOLEM,
|
|
|
|
|
RC_STONEGOLEM,
|
|
|
|
|
|
|
|
|
|
RC_SHADOW,
|
|
|
|
|
RC_SHADOWLORD,
|
|
|
|
|
RC_IRONKEEPER,
|
|
|
|
|
RC_ALP,
|
|
|
|
|
RC_TOAD,
|
|
|
|
|
|
|
|
|
|
RC_HIRNTOETER,
|
|
|
|
|
RC_PEASANT,
|
|
|
|
|
RC_WOLF = 32,
|
|
|
|
|
|
|
|
|
|
RC_SONGDRAGON = 37,
|
|
|
|
|
|
|
|
|
|
RC_SEASERPENT = 51,
|
|
|
|
|
RC_SHADOWKNIGHT,
|
|
|
|
|
RC_CENTAUR,
|
|
|
|
|
RC_SKELETON,
|
|
|
|
|
|
|
|
|
|
RC_SKELETON_LORD,
|
|
|
|
|
RC_ZOMBIE,
|
|
|
|
|
RC_ZOMBIE_LORD,
|
|
|
|
|
RC_GHOUL,
|
|
|
|
|
RC_GHOUL_LORD,
|
|
|
|
|
|
|
|
|
|
RC_MUS_SPIRIT,
|
|
|
|
|
RC_GNOME,
|
|
|
|
|
RC_TEMPLATE,
|
|
|
|
|
RC_CLONE,
|
|
|
|
|
|
|
|
|
|
MAXRACES,
|
|
|
|
|
NORACE = -1
|
|
|
|
|
} race_t;
|
|
|
|
|
|
|
|
|
|
typedef struct att {
|
|
|
|
|
int type;
|
|
|
|
|
union {
|
|
|
|
|
const char *dice;
|
|
|
|
|
const struct spell *sp;
|
|
|
|
|
} data;
|
|
|
|
|
int flags;
|
|
|
|
|
int level;
|
|
|
|
|
} att;
|
|
|
|
|
|
2016-08-28 21:44:09 +02:00
|
|
|
|
typedef const char *(*race_desc_func)(const struct race *rc, const struct locale *lang);
|
2016-08-28 21:27:40 +02:00
|
|
|
|
typedef void (*race_name_func)(struct unit *);
|
2016-08-28 19:15:00 +02:00
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
typedef struct race {
|
2014-12-30 01:44:28 +01:00
|
|
|
|
char *_name;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
float magres;
|
2015-05-15 13:32:22 +02:00
|
|
|
|
double maxaura; /* Faktor auf Maximale Aura */
|
|
|
|
|
double regaura; /* Faktor auf Regeneration */
|
|
|
|
|
double recruit_multi; /* Faktor f<>r Bauernverbrauch */
|
2014-12-09 07:20:36 +01:00
|
|
|
|
int index;
|
|
|
|
|
int recruitcost;
|
|
|
|
|
int maintenance;
|
|
|
|
|
int splitsize;
|
|
|
|
|
int weight;
|
|
|
|
|
int capacity;
|
|
|
|
|
float speed;
|
|
|
|
|
float aggression; /* chance that a monster will attack */
|
|
|
|
|
int hitpoints;
|
2014-12-30 01:44:28 +01:00
|
|
|
|
char *def_damage;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
int armor;
|
|
|
|
|
int at_default; /* Angriffsskill Unbewaffnet (default: -2) */
|
|
|
|
|
int df_default; /* Verteidigungsskill Unbewaffnet (default: -2) */
|
|
|
|
|
int at_bonus; /* Ver<65>ndert den Angriffsskill (default: 0) */
|
|
|
|
|
int df_bonus; /* Ver<65>ndert den Verteidigungskill (default: 0) */
|
2015-08-06 17:57:51 +02:00
|
|
|
|
struct param *parameters; // additional properties, for an example see natural_armor
|
2014-12-09 07:20:36 +01:00
|
|
|
|
const struct spell *precombatspell;
|
|
|
|
|
signed char *study_speed; /* study-speed-bonus in points/turn (0=30 Tage) */
|
|
|
|
|
int flags;
|
|
|
|
|
int battle_flags;
|
|
|
|
|
int ec_flags;
|
2015-01-19 15:13:03 +01:00
|
|
|
|
struct att attack[RACE_ATTACKS];
|
2015-01-12 22:53:21 +01:00
|
|
|
|
signed char bonus[MAXSKILLS];
|
2014-12-09 07:20:36 +01:00
|
|
|
|
|
2016-08-28 21:02:45 +02:00
|
|
|
|
race_name_func generate_name;
|
2016-08-28 21:44:09 +02:00
|
|
|
|
race_desc_func describe;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
void(*age) (struct unit * u);
|
|
|
|
|
bool(*move_allowed) (const struct region *, const struct region *);
|
|
|
|
|
struct item *(*itemdrop) (const struct race *, int size);
|
|
|
|
|
void(*init_familiar) (struct unit *);
|
|
|
|
|
|
|
|
|
|
const struct race *familiars[MAXMAGIETYP];
|
|
|
|
|
struct attrib *attribs;
|
|
|
|
|
struct race *next;
|
|
|
|
|
} race;
|
|
|
|
|
|
|
|
|
|
typedef struct race_list {
|
|
|
|
|
struct race_list *next;
|
|
|
|
|
const struct race *data;
|
|
|
|
|
} race_list;
|
|
|
|
|
|
2016-08-28 21:44:09 +02:00
|
|
|
|
void racelist_clear(struct race_list **rl);
|
|
|
|
|
void racelist_insert(struct race_list **rl, const struct race *r);
|
2014-12-09 07:20:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct race_list *get_familiarraces(void);
|
|
|
|
|
struct race *races;
|
|
|
|
|
struct race *get_race(race_t rt);
|
|
|
|
|
/** TODO: compatibility hacks: **/
|
|
|
|
|
race_t old_race(const struct race *);
|
|
|
|
|
|
2016-08-28 21:44:09 +02:00
|
|
|
|
race *rc_get_or_create(const char *name);
|
2016-09-19 06:55:32 +02:00
|
|
|
|
bool rc_changed(int *cache);
|
2016-08-28 21:44:09 +02:00
|
|
|
|
const race *rc_find(const char *);
|
2014-12-09 07:20:36 +01:00
|
|
|
|
void free_races(void);
|
|
|
|
|
|
|
|
|
|
typedef enum name_t { NAME_SINGULAR, NAME_PLURAL, NAME_DEFINITIVE, NAME_CATEGORY } name_t;
|
|
|
|
|
const char * rc_name_s(const race *rc, name_t n);
|
|
|
|
|
const char * rc_name(const race *rc, name_t n, char *name, size_t size);
|
|
|
|
|
|
|
|
|
|
/* Flags. Do not reorder these without changing json_race() in jsonconf.c */
|
2014-07-06 04:29:12 +02:00
|
|
|
|
#define RCF_NPC (1<<0) /* cannot be the race for a player faction (and other limits?) */
|
|
|
|
|
#define RCF_KILLPEASANTS (1<<1) /* a monster that eats peasants */
|
|
|
|
|
#define RCF_SCAREPEASANTS (1<<2) /* a monster that scares peasants out of the hex */
|
|
|
|
|
#define RCF_NOSTEAL (1<<3) /* this race has high stealth, but is not allowed to steal */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define RCF_MOVERANDOM (1<<4)
|
|
|
|
|
#define RCF_CANNOTMOVE (1<<5)
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#define RCF_LEARN (1<<6) /* Lernt automatisch wenn struct faction == 0 */
|
|
|
|
|
#define RCF_FLY (1<<7) /* kann fliegen */
|
|
|
|
|
#define RCF_SWIM (1<<8) /* kann schwimmen */
|
|
|
|
|
#define RCF_WALK (1<<9) /* kann <20>ber Land gehen */
|
|
|
|
|
#define RCF_NOLEARN (1<<10) /* kann nicht normal lernen */
|
|
|
|
|
#define RCF_NOTEACH (1<<11) /* kann nicht lehren */
|
|
|
|
|
#define RCF_HORSE (1<<12) /* Einheit ist Pferd, sozusagen */
|
|
|
|
|
#define RCF_DESERT (1<<13) /* 5% Chance, das Einheit desertiert */
|
|
|
|
|
#define RCF_ILLUSIONARY (1<<14) /* (Illusion & Spell) Does not drop items. */
|
|
|
|
|
#define RCF_ABSORBPEASANTS (1<<15) /* T<>tet und absorbiert Bauern */
|
|
|
|
|
#define RCF_NOHEAL (1<<16) /* Einheit kann nicht geheilt werden */
|
|
|
|
|
#define RCF_NOWEAPONS (1<<17) /* Einheit kann keine Waffen benutzen */
|
|
|
|
|
#define RCF_SHAPESHIFT (1<<18) /* Kann TARNE RASSE benutzen. */
|
|
|
|
|
#define RCF_SHAPESHIFTANY (1<<19) /* Kann TARNE RASSE "string" benutzen. */
|
|
|
|
|
#define RCF_UNDEAD (1<<20) /* Undead. */
|
|
|
|
|
#define RCF_DRAGON (1<<21) /* Drachenart (f<>r Zauber) */
|
|
|
|
|
#define RCF_COASTAL (1<<22) /* kann in Landregionen an der K<>ste sein */
|
|
|
|
|
#define RCF_UNARMEDGUARD (1<<23) /* kann ohne Waffen bewachen */
|
|
|
|
|
#define RCF_CANSAIL (1<<24) /* Einheit darf Schiffe betreten */
|
|
|
|
|
#define RCF_INVISIBLE (1<<25) /* not visible in any report */
|
|
|
|
|
#define RCF_SHIPSPEED (1<<26) /* race gets +1 on shipspeed */
|
|
|
|
|
#define RCF_STONEGOLEM (1<<27) /* race gets stonegolem properties */
|
|
|
|
|
#define RCF_IRONGOLEM (1<<28) /* race gets irongolem properties */
|
2015-11-17 11:25:58 +01:00
|
|
|
|
#define RCF_ATTACK_MOVED (1<<29) /* may attack if it has moved */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
/* Economic flags */
|
2015-04-19 12:49:39 +02:00
|
|
|
|
#define ECF_KEEP_ITEM (1<<1) /* gibt Gegenst<73>nde weg */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define GIVEPERSON (1<<2) /* <20>bergibt Personen */
|
|
|
|
|
#define GIVEUNIT (1<<3) /* Einheiten an andere Partei <20>bergeben */
|
|
|
|
|
#define GETITEM (1<<4) /* nimmt Gegenst<73>nde an */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#define ECF_REC_HORSES (1<<6) /* Rekrutiert aus Pferden */
|
|
|
|
|
#define ECF_REC_ETHEREAL (1<<7) /* Rekrutiert aus dem Nichts */
|
|
|
|
|
#define ECF_REC_UNLIMITED (1<<8) /* Rekrutiert ohne Limit */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
/* Battle-Flags */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#define BF_EQUIPMENT (1<<0) /* Kann Ausr<73>stung benutzen */
|
|
|
|
|
#define BF_NOBLOCK (1<<1) /* Wird in die R<>ckzugsberechnung nicht einbezogen */
|
|
|
|
|
#define BF_RES_PIERCE (1<<2) /* Halber Schaden durch PIERCE */
|
|
|
|
|
#define BF_RES_CUT (1<<3) /* Halber Schaden durch CUT */
|
|
|
|
|
#define BF_RES_BASH (1<<4) /* Halber Schaden durch BASH */
|
|
|
|
|
#define BF_INV_NONMAGIC (1<<5) /* Immun gegen nichtmagischen Schaden */
|
2015-12-05 17:17:21 +01:00
|
|
|
|
#define BF_NO_ATTACK (1<<6) /* Kann keine ATTACKIERE Befehle ausfuehren */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
|
2015-11-24 19:53:27 +01:00
|
|
|
|
const char *racename(const struct locale *lang, const struct unit *u,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
const race * rc);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-06-30 03:10:02 +02:00
|
|
|
|
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-07-06 04:20:15 +02:00
|
|
|
|
#define playerrace(rc) (!fval((rc), RCF_NPC))
|
2014-06-30 03:10:02 +02:00
|
|
|
|
#define dragonrace(rc) ((rc) == get_race(RC_FIREDRAGON) || (rc) == get_race(RC_DRAGON) || (rc) == get_race(RC_WYRM) || (rc) == get_race(RC_BIRTHDAYDRAGON))
|
|
|
|
|
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
|
|
|
|
|
2015-11-24 19:53:27 +01:00
|
|
|
|
bool allowed_dragon(const struct region *src,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
const struct region *target);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2015-11-24 19:53:27 +01:00
|
|
|
|
bool r_insectstalled(const struct region *r);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2015-11-24 19:53:27 +01:00
|
|
|
|
void write_race_reference(const struct race *rc,
|
|
|
|
|
struct storage *store);
|
|
|
|
|
variant read_race_reference(struct storage *store);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2015-11-24 19:53:27 +01:00
|
|
|
|
const char *raceprefix(const struct unit *u);
|
2016-08-28 21:02:45 +02:00
|
|
|
|
void register_race_name_function(race_name_func, const char *);
|
2016-08-28 21:44:09 +02:00
|
|
|
|
void register_race_description_function(race_desc_func, const char *);
|
2016-08-28 21:27:40 +02:00
|
|
|
|
char * race_namegen(const struct race *rc, struct unit *u);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|