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
|
2016-11-25 20:15:11 +01:00
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include "magic.h" /* wegen MAXMAGIETYP */
|
|
|
|
|
#include "skill.h"
|
|
|
|
|
|
2010-08-08 10:06:34 +02:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#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;
|
2017-01-28 19:42:20 +01:00
|
|
|
|
struct spellref;
|
2016-11-22 12:32:28 +01:00
|
|
|
|
struct locale;
|
2017-02-06 09:03:08 +01:00
|
|
|
|
struct rcoption;
|
2017-02-28 10:48:27 +01:00
|
|
|
|
struct item_type;
|
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,
|
2017-02-20 20:42:31 +01:00
|
|
|
|
|
|
|
|
|
RC_FIREDRAGON = 15,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
RC_DRAGON,
|
|
|
|
|
RC_WYRM,
|
|
|
|
|
RC_TREEMAN,
|
|
|
|
|
RC_BIRTHDAYDRAGON,
|
|
|
|
|
RC_DRACOID,
|
2016-09-22 18:28:37 +02:00
|
|
|
|
|
|
|
|
|
RC_SPELL = 22,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
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,
|
|
|
|
|
|
2016-09-22 18:28:37 +02:00
|
|
|
|
RC_SKELETON = 54,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
RC_SKELETON_LORD,
|
|
|
|
|
RC_ZOMBIE,
|
|
|
|
|
RC_ZOMBIE_LORD,
|
|
|
|
|
RC_GHOUL,
|
|
|
|
|
RC_GHOUL_LORD,
|
2016-09-22 18:28:37 +02:00
|
|
|
|
RC_TEMPLATE = 62,
|
2014-12-09 07:20:36 +01:00
|
|
|
|
RC_CLONE,
|
|
|
|
|
MAXRACES,
|
|
|
|
|
NORACE = -1
|
|
|
|
|
} race_t;
|
|
|
|
|
|
2017-04-17 20:11:44 +02:00
|
|
|
|
extern int num_races;
|
|
|
|
|
extern const char *racenames[MAXRACES];
|
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
typedef struct att {
|
|
|
|
|
int type;
|
|
|
|
|
union {
|
2017-02-07 21:37:38 +01:00
|
|
|
|
char *dice;
|
2017-01-28 19:52:28 +01:00
|
|
|
|
struct spellref *sp;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
} data;
|
|
|
|
|
int flags;
|
|
|
|
|
int level;
|
|
|
|
|
} att;
|
|
|
|
|
|
2017-02-20 22:07:36 +01:00
|
|
|
|
typedef void (*race_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;
|
2017-02-24 20:47:47 +01:00
|
|
|
|
variant magres;
|
2017-02-03 18:18:55 +01:00
|
|
|
|
int healing;
|
2017-02-03 20:06:01 +01:00
|
|
|
|
int maxaura; /* Faktor auf Maximale Aura */
|
2015-05-15 13:32:22 +02:00
|
|
|
|
double regaura; /* Faktor auf Regeneration */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
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;
|
2016-10-04 09:14:49 +02:00
|
|
|
|
int income;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
float speed;
|
|
|
|
|
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) */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
int at_bonus; /* Ver<65>ndert den Angriffsskill (default: 0) */
|
|
|
|
|
int df_bonus; /* Ver<65>ndert den Verteidigungskill (default: 0) */
|
2014-12-09 07:20:36 +01:00
|
|
|
|
signed char *study_speed; /* study-speed-bonus in points/turn (0=30 Tage) */
|
|
|
|
|
int flags;
|
|
|
|
|
int battle_flags;
|
|
|
|
|
int ec_flags;
|
2017-02-28 10:48:27 +01:00
|
|
|
|
int mask_item;
|
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
|
|
|
|
|
2017-02-20 22:07:36 +01:00
|
|
|
|
race_func name_unit;
|
|
|
|
|
race_func age_unit;
|
2014-12-09 07:20:36 +01:00
|
|
|
|
|
2017-02-18 21:15:14 +01:00
|
|
|
|
struct rcoption *options; /* rarely used properties */
|
2017-02-06 09:03:08 +01:00
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
const struct race *familiars[MAXMAGIETYP];
|
|
|
|
|
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
|
|
|
|
|
2016-11-22 12:32:28 +01:00
|
|
|
|
const struct race *findrace(const char *, const struct locale *);
|
2014-12-09 07:20:36 +01:00
|
|
|
|
|
|
|
|
|
struct race_list *get_familiarraces(void);
|
|
|
|
|
struct race *races;
|
2016-09-20 20:27:41 +02:00
|
|
|
|
const struct race *get_race(race_t rt);
|
2014-12-09 07:20:36 +01:00
|
|
|
|
/** TODO: compatibility hacks: **/
|
|
|
|
|
race_t old_race(const struct race *);
|
|
|
|
|
|
2016-09-20 20:27:41 +02:00
|
|
|
|
race *rc_create(const char *zName);
|
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);
|
|
|
|
|
|
2017-02-28 10:48:27 +01:00
|
|
|
|
bool rc_can_use(const struct race *rc, const struct item_type *itype);
|
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
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);
|
2017-04-17 20:11:44 +02:00
|
|
|
|
const char * rc_key(const char *rcname, name_t n, char *name, size_t size);
|
2014-12-09 07:20:36 +01:00
|
|
|
|
const char * rc_name(const race *rc, name_t n, char *name, size_t size);
|
|
|
|
|
|
2017-02-05 16:55:51 +01:00
|
|
|
|
void rc_set_param(struct race *rc, const char *key, const char *value);
|
|
|
|
|
|
2017-02-06 09:46:36 +01:00
|
|
|
|
int rc_luxury_trade(const struct race *rc);
|
|
|
|
|
int rc_herb_trade(const struct race *rc);
|
2017-02-24 20:47:47 +01:00
|
|
|
|
variant rc_magres(const struct race *rc);
|
2017-02-03 19:50:48 +01:00
|
|
|
|
double rc_maxaura(const struct race *rc);
|
2017-02-04 23:16:16 +01:00
|
|
|
|
int rc_armor_bonus(const struct race *rc);
|
2017-02-05 18:38:53 +01:00
|
|
|
|
int rc_scare(const struct race *rc);
|
2017-02-06 09:46:36 +01:00
|
|
|
|
const char * rc_hungerdamage(const race *rc);
|
2017-02-06 09:03:08 +01:00
|
|
|
|
const race *rc_otherrace(const race *rc);
|
2017-02-04 23:16:16 +01:00
|
|
|
|
|
|
|
|
|
#define MIGRANTS_NONE 0
|
|
|
|
|
#define MIGRANTS_LOG10 1
|
|
|
|
|
int rc_migrants_formula(const race *rc);
|
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
/* 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 */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define RCF_WALK (1<<9) /* kann <20>ber Land gehen */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#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. */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define RCF_ABSORBPEASANTS (1<<15) /* T<>tet und absorbiert Bauern */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#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. */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define RCF_DRAGON (1<<21) /* Drachenart (f<>r Zauber) */
|
|
|
|
|
#define RCF_COASTAL (1<<22) /* kann in Landregionen an der K<>ste sein */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#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 */
|
2017-02-04 23:42:50 +01:00
|
|
|
|
#define RCF_MIGRANTS (1<<30) /* may have migrant units (human bonus) */
|
2017-02-20 09:32:03 +01:00
|
|
|
|
#define RCF_FAMILIAR (1<<31) /* may be a familiar */
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
2014-12-09 07:20:36 +01:00
|
|
|
|
/* Economic flags */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define ECF_KEEP_ITEM (1<<1) /* gibt Gegenst<73>nde weg */
|
|
|
|
|
#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_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 */
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define BF_EQUIPMENT (1<<0) /* Kann Ausr<73>stung benutzen */
|
|
|
|
|
#define BF_NOBLOCK (1<<1) /* Wird in die R<>ckzugsberechnung nicht einbezogen */
|
2011-03-07 08:02:35 +01:00
|
|
|
|
#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
|
|
|
|
|
2016-11-17 17:06:31 +01:00
|
|
|
|
#define playerrace(rc) (!((rc)->flags & RCF_NPC))
|
|
|
|
|
#define dragonrace(rc) ((rc)->flags & RCF_DRAGON)
|
|
|
|
|
#define humanoidrace(rc) (((rc)->flags & RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
|
|
|
|
|
#define illusionaryrace(rc) ((rc)->flags & RCF_ILLUSIONARY)
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
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);
|
2017-02-20 22:07:36 +01:00
|
|
|
|
void register_race_function(race_func, const char *);
|
2010-08-08 10:06:34 +02:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|