 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
31 static std::vector<object *>
gods;
42 LOG(
llevError,
"ERROR: Tried to add null god to list!\n");
95 auto god = std::find_if(
gods.begin(),
gods.end(), [&] (
const object *god) {
96 return god->race && !strcasecmp(god->race, race);
98 return god ==
gods.end() ? nullptr : (*god)->name;
110 int hassomething = 0, real = 0;
167 int has_effect = 0, tmpvar;
174 if (god->
resist[tmpvar] == 100) {
200 stringbuffer_append_printf(add,
"\nThe priests of %s are known to be able to bestow a blessing which grants the recipient:\n%s\n ---\n",
name, cp);
244 stringbuffer_append_printf(add,
"%s has a potent aura which is extended to faithful priests. The effects of this aura include:\n%s\n ---\n",
name, cp);
298 if (hassomething == 0) {
318 auto found = std::find_if(
gods.begin(),
gods.end(), [&] (
const object *god) {
319 return !strcmp(name, god->name);
331 #define DESCRIBE_ABILITY(retbuf, variable, name) \
334 strcat(retbuf, "(" name ": "); \
335 for (i = 0; i < NROFATTACKS; i++) \
336 if (variable&(1<<i)) { \
338 strcat(retbuf, ", "); \
341 strcat(retbuf, attacks[i]); \
343 strcat(retbuf, ")"); \
346 #define DESCRIBE_PATH(retbuf, variable, name) \
349 strcat(retbuf, "(" name ": "); \
350 for (i = 0; i < NRSPELLPATHS; i++) \
351 if (variable&(1<<i)) { \
353 strcat(retbuf, ", "); \
356 strcat(retbuf, spellpathnames[i]); \
358 strcat(retbuf, ")"); \
371 fprintf(stderr,
"\n");
372 for (glist = first_god; glist; glist = glist->next) {
373 const object *god = &glist->arch->clone;
375 int tmpvar, gifts = 0;
377 fprintf(stderr,
"GOD: %s\n", god->
name);
378 fprintf(stderr,
" avatar stats:\n");
380 fprintf(stderr,
" lvl:%d speed:%4.2f\n", god->
level, god->
speed);
382 fprintf(stderr,
" enemy: %s\n", god->
title ? god->
title :
"NONE");
387 fprintf(stderr,
" lvl:%d speed:%4.2f\n", serv->
level, serv->
speed);
390 fprintf(stderr,
" servant: NONE\n");
391 fprintf(stderr,
" aligned_race(s): %s\n", god->
race);
392 fprintf(stderr,
" enemy_race(s): %s\n", (god->
slaying ? god->
slaying :
"none"));
394 fprintf(stderr,
"%s",
final);
396 snprintf(tmpbuf,
sizeof(tmpbuf),
" attacktype:");
398 strcat(tmpbuf,
"\n ");
401 strcat(tmpbuf,
"\n aura:");
403 strcat(tmpbuf,
"\n paths:");
405 strcat(tmpbuf,
"\n ");
409 strcat(tmpbuf,
"\n ");
413 strcat(tmpbuf,
"\n ");
416 fprintf(stderr,
"%s\n", tmpbuf);
417 fprintf(stderr,
" Desc: %s", god->
msg ? god->
msg :
"---\n");
418 fprintf(stderr,
" Priest gifts/limitations: ");
429 if (god->
last_heal) { gifts = 1; fprintf(stderr,
"\n hp regenerate at %d", god->
last_heal); }
430 if (god->
last_sp) { gifts = 1; fprintf(stderr,
"\n sp regenerate at %d", god->
last_sp); }
431 if (god->
last_eat) { gifts = 1; fprintf(stderr,
"\n digestion is %s (%d)", god->
last_eat < 0 ?
"slowed" :
"faster", god->
last_eat); }
432 if (god->
last_grace) { gifts = 1; fprintf(stderr,
"\n grace regenerates at %d", god->
last_grace); }
433 if (god->
stats.
luck) { gifts = 1; fprintf(stderr,
"\n luck is %d", god->
stats.
luck); }
434 if (!gifts) fprintf(stderr,
"NONE");
435 fprintf(stderr,
"\n\n");
#define GOD_IMMUNITIES
Write immunities.
size_t stringbuffer_length(StringBuffer *sb)
Return the current length of the buffer.
@ llevError
Error, serious thing.
#define GOD_PATHS
Path information.
uint32_t path_attuned
Paths the object is attuned to.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_UNDEAD
Monster is undead.
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
Arrows will reflect from object.
void archetypes_for_each(arch_op op)
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
#define FLAG_SEE_IN_DARK
if set ob not effected by darkness
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
float speed
Frequency of object 'moves' relative to server tick rate.
char * strtoktolin(const char *buf1, const char *buf2, char *retbuf, size_t size)
Takes a string in buf1 and separates it into a list of strings delimited by buf2.
int16_t last_grace
As last_sp, except for grace.
void dump_gods(void)
Prints all gods to stderr.
sstring title
Of foo, etc.
#define GOD_BLESSED
Write various information (resistances?).
int16_t level
Level of creature or object.
#define FLAG_STEALTH
Will wake monsters with less range.
#define HUGE_BUF
Used for messages - some can be quite long.
#define GOD_HOLYWORD
Write holy word information.
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
const object * find_god(const char *name)
Returns a god's object from its name.
Plugin animator file specs[Config] name
uint32_t path_denied
Paths the object is denied access to.
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
uint32_t path_repelled
Paths the object is repelled from.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
const object * get_rand_god(void)
Returns a random god.
int32_t last_heal
Last healed.
StringBuffer * describe_resistance(const object *op, int newline, int use_media_tags, StringBuffer *buf)
Generates the visible naming for resistances.
#define DESCRIBE_ABILITY(retbuf, variable, name)
object clone
An object from which to do object_copy()
StringBuffer * describe_spellpath_attenuation(const char *attenuation, int value, StringBuffer *buf)
Describe the specified path attenuation.
#define FLAG_BLIND
If set, object cannot see (visually)
#define FLAG_MAKE_INVIS
(Item) gives invisibility when applied
int32_t last_eat
How long since we last ate.
uint8_t type
PLAYER, BULLET, etc.
int16_t dam
How much damage this object does when hitting.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
const char * get_god_for_race(const char *race)
Returns a string that is the name of the god that should be natively worshipped by a creature of who ...
#define FLAG_USE_WEAPON
(Monster) can wield weapons
void stringbuffer_append_string(StringBuffer *sb, const char *str)
Append a string to a string buffer instance.
sstring race
Human, goblin, dragon, etc.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
static void add_god_to_list(archetype *god_arch)
Adds specified god to linked list if god, gives it an id.
#define MAX_BUF
Used for all kinds of things.
void free_all_god(void)
Frees all god information.
int8_t wc
Weapon Class, lower WC increases probability of hitting.
A buffer that will be expanded as content is added to it.
#define GOD_RESISTANCES
Write resistances.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
sstring slaying
Which race to do double damage to.
sstring name
The name of the object, obviously...
const char *const attacktype_desc[NROFATTACKS]
Short description of names of the attacktypes.
#define DESCRIBE_PATH(retbuf, variable, name)
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
int32_t last_sp
As last_heal, but for spell points.
#define GOD_ENEMY
Write down god's enemy.
sstring msg
If this is a book/sign/magic mouth/etc.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
void stringbuffer_append_stringbuffer(StringBuffer *sb, const StringBuffer *sb2)
Append the contents of a string buffer instance to another string buffer instance.
static std::vector< object * > gods
sstring name
More definite name, like "generate_kobold".
#define FLAG_XRAYS
X-ray vision.
living stats
Str, Con, Dex, etc.
int describe_god(const object *god, int what, StringBuffer *buf, size_t maxlen)
Describe a god.
uint32_t attacktype
Bitmask of attacks this object does.
int nstrtok(const char *buf1, const char *buf2)
Simple routine to return the number of list items in buf1 as separated by the value of buf2.
int8_t luck
Affects thaco and ac from time to time.
@ llevDebug
Only for debugging purposes.
#define GOD_SACRED
Write sacred creatures.