2001-01-25 10:37:55 +01:00
|
|
|
|
/* vi: set ts=2:
|
|
|
|
|
*
|
2003-07-29 11:48:03 +02:00
|
|
|
|
* Eressea PB(E)M host Copyright (C) 1998-2003
|
2001-01-25 10:37:55 +01:00
|
|
|
|
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
|
|
|
|
* Katja Zedel (katze@felidae.kn-bremen.de)
|
|
|
|
|
* Henning Peters (faroul@beyond.kn-bremen.de)
|
|
|
|
|
* Enno Rehling (enno@eressea-pbem.de)
|
|
|
|
|
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
|
|
|
|
*
|
|
|
|
|
* based on:
|
|
|
|
|
*
|
|
|
|
|
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
|
|
|
|
|
* Atlantis v1.7 Copyright 1996 by Alex Schr<EFBFBD>der
|
|
|
|
|
*
|
|
|
|
|
* This program may not be used, modified or distributed without
|
|
|
|
|
* prior permission by the authors of Eressea.
|
|
|
|
|
* This program may not be sold or used commercially without prior written
|
|
|
|
|
* permission from the authors.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-07-29 11:48:03 +02:00
|
|
|
|
#ifndef H_KRNL_RACE_H
|
|
|
|
|
#define H_KRNL_RACE_H
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "magic.h" /* wegen MAXMAGIETYP */
|
2001-01-25 10:37:55 +01: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
|
|
|
|
|
|
2002-04-27 19:49:36 +02:00
|
|
|
|
#define GOLEM_IRON 4 /* Anzahl Eisen in einem Eisengolem */
|
|
|
|
|
#define GOLEM_STONE 4 /* Anzahl Steine in einem Steingolem */
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
2002-05-05 20:41:15 +02:00
|
|
|
|
#define RACESPOILCHANCE 5 /* Chance auf rassentypische Beute */
|
|
|
|
|
|
2001-01-25 10:37:55 +01:00
|
|
|
|
typedef struct att {
|
|
|
|
|
int type;
|
|
|
|
|
union {
|
|
|
|
|
const char * dice;
|
2005-10-08 21:22:56 +02:00
|
|
|
|
const spell * sp;
|
2001-01-25 10:37:55 +01:00
|
|
|
|
} data;
|
|
|
|
|
int flags;
|
|
|
|
|
} att;
|
|
|
|
|
|
2001-09-05 21:40:40 +02:00
|
|
|
|
typedef struct race_syn {
|
|
|
|
|
race_t race;
|
|
|
|
|
const char *synonyms[4];
|
|
|
|
|
} race_syn;
|
|
|
|
|
|
2001-12-10 01:13:39 +01:00
|
|
|
|
typedef struct race {
|
|
|
|
|
const char *_name[4]; /* neu: name[4]v<>lker */
|
2005-05-05 04:50:14 +02:00
|
|
|
|
float magres;
|
|
|
|
|
float maxaura; /* Faktor auf Maximale Aura */
|
|
|
|
|
float regaura; /* Faktor auf Regeneration */
|
2001-12-10 01:13:39 +01:00
|
|
|
|
int recruitcost;
|
2001-01-25 10:37:55 +01:00
|
|
|
|
int maintenance;
|
|
|
|
|
int splitsize;
|
|
|
|
|
int weight;
|
2002-04-21 11:23:05 +02:00
|
|
|
|
int capacity;
|
2005-05-05 04:50:14 +02:00
|
|
|
|
float speed;
|
|
|
|
|
float aggression; /* chance that a monster will attack */
|
2001-01-25 10:37:55 +01:00
|
|
|
|
int hitpoints;
|
|
|
|
|
const char *def_damage;
|
|
|
|
|
char armor;
|
|
|
|
|
char at_default; /* Angriffsskill Unbewaffnet (default: -2)*/
|
|
|
|
|
char df_default; /* Verteidigungsskill Unbewaffnet (default: -2)*/
|
|
|
|
|
char at_bonus; /* Ver<65>ndert den Angriffsskill (default: 0)*/
|
|
|
|
|
char df_bonus; /* Ver<65>ndert den Verteidigungskill (default: 0)*/
|
2005-10-08 20:27:40 +02:00
|
|
|
|
const spell * precombatspell;
|
2002-02-23 20:04:51 +01:00
|
|
|
|
struct att attack[10];
|
2001-01-25 10:37:55 +01:00
|
|
|
|
char bonus[MAXSKILLS];
|
2001-12-10 01:13:39 +01:00
|
|
|
|
boolean __remove_me_nonplayer;
|
2001-01-25 10:37:55 +01:00
|
|
|
|
int flags;
|
|
|
|
|
int battle_flags;
|
|
|
|
|
int ec_flags;
|
2001-12-10 01:13:39 +01:00
|
|
|
|
race_t oldfamiliars[MAXMAGIETYP];
|
|
|
|
|
|
2001-02-02 09:40:49 +01:00
|
|
|
|
const char *(*generate_name) (const struct unit *);
|
2001-12-10 01:13:39 +01:00
|
|
|
|
void (*age)(struct unit *u);
|
2001-02-13 00:29:36 +01:00
|
|
|
|
boolean (*move_allowed)(const struct region *, const struct region *);
|
2001-12-10 01:13:39 +01:00
|
|
|
|
struct item * (*itemdrop)(const struct race *, int size);
|
|
|
|
|
void (*init_familiar)(struct unit *);
|
|
|
|
|
|
|
|
|
|
const struct race * familiars[MAXMAGIETYP];
|
2001-02-03 14:45:35 +01:00
|
|
|
|
struct attrib * attribs;
|
2001-12-10 01:13:39 +01:00
|
|
|
|
struct race * next;
|
|
|
|
|
} race;
|
2001-02-03 14:45:35 +01:00
|
|
|
|
|
2004-06-11 21:59:02 +02:00
|
|
|
|
typedef struct race_list {
|
|
|
|
|
struct race_list * next;
|
|
|
|
|
const struct race * data;
|
|
|
|
|
} race_list;
|
|
|
|
|
|
|
|
|
|
extern void racelist_clear(struct race_list **rl);
|
|
|
|
|
extern void racelist_insert(struct race_list **rl, const struct race *r);
|
|
|
|
|
|
2006-02-10 22:15:08 +01:00
|
|
|
|
extern struct race_list * get_familiarraces(void);
|
2001-12-10 01:13:39 +01:00
|
|
|
|
extern struct race * races;
|
|
|
|
|
|
|
|
|
|
extern struct race * rc_find(const char *);
|
|
|
|
|
extern const char * rc_name(const struct race *, int);
|
|
|
|
|
extern struct race * rc_add(struct race *);
|
2004-03-28 22:53:47 +02:00
|
|
|
|
extern struct race * rc_new(const char * zName);
|
2001-12-10 01:13:39 +01:00
|
|
|
|
extern int rc_specialdamage(const race *, const race *, const struct weapon_type *);
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
|
|
/* Flags */
|
2001-12-10 01:13:39 +01:00
|
|
|
|
#define RCF_PLAYERRACE (1<<0) /* can be played by a player. */
|
|
|
|
|
#define RCF_KILLPEASANTS (1<<1) /* T<>ten Bauern. D<>monen werden nicht <20>ber dieses Flag, sondern in randenc() behandelt. */
|
|
|
|
|
#define RCF_SCAREPEASANTS (1<<2)
|
2005-05-05 04:50:14 +02:00
|
|
|
|
|
2001-12-10 01:13:39 +01:00
|
|
|
|
#define RCF_MOVERANDOM (1<<4)
|
|
|
|
|
#define RCF_CANNOTMOVE (1<<5)
|
2001-02-03 14:45: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 */
|
2001-12-10 01:13:39 +01:00
|
|
|
|
#define RCF_ILLUSIONARY (1<<14) /* (Illusion & Spell) Does not drop items. */
|
2001-02-03 14:45:35 +01:00
|
|
|
|
#define RCF_ABSORBPEASANTS (1<<15) /* T<>tet und absorbiert Bauern */
|
|
|
|
|
#define RCF_NOHEAL (1<<16) /* Einheit kann nicht geheilt werden */
|
2001-12-10 01:13:39 +01:00
|
|
|
|
#define RCF_NOWEAPONS (1<<17) /* Einheit kann keine Waffen benutzen */
|
2001-04-01 08:58:45 +02:00
|
|
|
|
#define RCF_SHAPESHIFT (1<<18) /* Kann TARNE RASSE benutzen. */
|
- Neue Messages fertig
Messages werden jetzt in einem anderen Meta-Format (message* of
message_type*) gespeichert, das man in beliebige Formate (CR oder NR)
rendern kann. crmessage.c und nrmessage.c sind die render-engines dafür.
Die Messagetypen werden in res/{de,en}/messages.xml gesammelt, ultimativ
kann das aber durchaus eine einzelne Datei sein. Die ist derzeit nicht
wirklich xml (Umlaute drin, keine Definitionsdatei), aber gut lesbar.
- make_message
Diese Funktion ersetzt new_message, und ist etwas einfacher in der Syntax:
make_message("dumb_mistake", "unit region command", u, r, cmd) erzeugt
eine neue Nachricht, die dann einfach mit add_message wie bisher an die
Nachrichtenliste gehängt werden kann.
TODO: Messages könnte man durchaus reference-counten, und in mehrere Listen
einfügen, solang sie a) mehrfachverwendet (Kampf!) und b) vom Betrachter
unabhängig sind. Das spart einigen Speicher.
- CR Version erhöht.
Weil die MESSAGETYPES Blocks anders sind als früher
- OFFENSIVE_DELAY
Verbietet Einheiten, deren Partei eine Reigon niht bewachen, den
Angriff in der Region, wenn sie sich in der Runde zuvor bewegt haben.
Status der letzten Runde wird in neuem Attribut at_moved gespeichert.
- SHORT_ATTACKS
ein define, das angibt ob Kämpfen grundsätzlich keine lange Aktion ist.
- XML Parser
xml.[hc] enthält einen XML-Parser, dem man ein plugin mit callbacks
übergibt, die nach dem Parsen eines tokens aufgerufen werden.
2001-04-12 19:21:57 +02:00
|
|
|
|
#define RCF_SHAPESHIFTANY (1<<19) /* Kann TARNE RASSE "string" benutzen. */
|
2001-12-10 01:13:39 +01:00
|
|
|
|
#define RCF_UNDEAD (1<<20) /* Undead. */
|
2002-04-27 22:09:44 +02:00
|
|
|
|
#define RCF_DRAGON (1<<21) /* Drachenart (f<>r Zauber)*/
|
2005-04-16 13:24:50 +02:00
|
|
|
|
#define RCF_COASTAL (1<<22) /* kann in Landregionen an der K<>ste sein */
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
|
|
/* Economic flags */
|
|
|
|
|
#define NOGIVE (1<<0) /* gibt niemals nix */
|
|
|
|
|
#define GIVEITEM (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 */
|
2001-04-16 16:34:19 +02:00
|
|
|
|
#define CANGUARD (1<<5) /* bewachen auch ohne Waffen */
|
|
|
|
|
#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 */
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
|
|
/* Battle-Flags */
|
2001-12-10 01:13:39 +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 */
|
|
|
|
|
|
|
|
|
|
extern int unit_old_max_hp(struct unit * u);
|
|
|
|
|
extern const char * racename(const struct locale *lang, const struct unit *u, const race * rc);
|
|
|
|
|
|
|
|
|
|
#define omniscient(f) (((f)->race)==new_race[RC_ILLUSION] || ((f)->race)==new_race[RC_TEMPLATE])
|
|
|
|
|
|
|
|
|
|
#define playerrace(rc) (fval((rc), RCF_PLAYERRACE))
|
|
|
|
|
#define dragonrace(rc) ((rc) == new_race[RC_FIREDRAGON] || (rc) == new_race[RC_DRAGON] || (rc) == new_race[RC_WYRM] || (rc) == new_race[RC_BIRTHDAYDRAGON])
|
|
|
|
|
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==new_race[RC_DRACOID] || playerrace(rc))
|
|
|
|
|
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
2001-01-25 10:37:55 +01:00
|
|
|
|
|
|
|
|
|
extern boolean allowed_dragon(const struct region * src, const struct region * target);
|
|
|
|
|
|
2002-01-09 09:20:33 +01:00
|
|
|
|
extern void register_races(void);
|
2004-03-07 13:50:53 +01:00
|
|
|
|
extern void init_races(void);
|
2001-09-05 21:40:40 +02:00
|
|
|
|
extern boolean r_insectstalled(const struct region *r);
|
|
|
|
|
|
2004-08-07 09:42:22 +02:00
|
|
|
|
extern void add_raceprefix(const char *);
|
|
|
|
|
extern char ** race_prefixes;
|
2001-09-05 21:40:40 +02:00
|
|
|
|
extern const struct race_syn race_synonyms[];
|
2001-02-03 14:45:35 +01:00
|
|
|
|
|
2001-12-10 01:13:39 +01:00
|
|
|
|
extern void write_race_reference(const struct race * rc, FILE * F);
|
2002-04-07 02:44:01 +02:00
|
|
|
|
extern int read_race_reference(const struct race ** rp, FILE * F);
|
2001-12-10 01:13:39 +01:00
|
|
|
|
|
2003-09-21 10:20:58 +02:00
|
|
|
|
extern const char * raceprefix(const struct unit *u);
|
|
|
|
|
|
2005-10-02 22:28:44 +02:00
|
|
|
|
extern void give_starting_equipment(struct unit *u);
|
2003-12-14 20:17:59 +01:00
|
|
|
|
|
2003-07-29 11:48:03 +02:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
|
#endif
|