Angband
Macros | Functions
mon-desc.h File Reference

Monster description. More...

#include "monster.h"

Go to the source code of this file.

Macros

#define MDESC_DEFAULT   0x00 /* "it" or "the kobold" */
 Bit flags for the "monster_desc" function. More...
 
#define MDESC_OBJE   0x01 /* Objective (or Reflexive) */
 
#define MDESC_POSS   0x02 /* Possessive (or Reflexive) */
 
#define MDESC_IND_HID   0x04 /* Indefinites for hidden monsters */
 
#define MDESC_IND_VIS   0x08 /* Indefinites for visible monsters */
 
#define MDESC_PRO_HID   0x10 /* Pronominalize hidden monsters */
 
#define MDESC_PRO_VIS   0x20 /* Pronominalize visible monsters */
 
#define MDESC_HIDE   0x40 /* Assume the monster is hidden */
 
#define MDESC_SHOW   0x80 /* Assume the monster is visible */
 
#define MDESC_CAPITAL   0x100 /* Capitalise */
 
#define MDESC_STANDARD   (MDESC_CAPITAL | MDESC_IND_HID | MDESC_PRO_HID)
 
#define MDESC_DIED_FROM   (MDESC_SHOW | MDESC_IND_VIS)
 

Functions

void plural_aux (char *name, size_t max)
 Perform simple English pluralization on a monster name. More...
 
void get_mon_name (char *buf, size_t buflen, const struct monster_race *race, int num)
 Helper function for display monlist. More...
 
void monster_desc (char *desc, size_t max, const struct monster *mon, int mode)
 Builds a string describing a monster in some way. More...
 

Detailed Description

Monster description.

Copyright (c) 1997-2007 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation

#define MDESC_CAPITAL   0x100 /* Capitalise */
#define MDESC_DEFAULT   0x00 /* "it" or "the kobold" */

Bit flags for the "monster_desc" function.

Referenced by do_cmd_walk_test(), mon_take_hit(), and monster_take_terrain_damage().

#define MDESC_DIED_FROM   (MDESC_SHOW | MDESC_IND_VIS)
#define MDESC_HIDE   0x40 /* Assume the monster is hidden */

Referenced by monster_desc().

#define MDESC_IND_HID   0x04 /* Indefinites for hidden monsters */
#define MDESC_IND_VIS   0x08 /* Indefinites for visible monsters */
#define MDESC_OBJE   0x01 /* Objective (or Reflexive) */
#define MDESC_POSS   0x02 /* Possessive (or Reflexive) */
#define MDESC_PRO_HID   0x10 /* Pronominalize hidden monsters */

Referenced by monster_desc(), and py_attack_real().

#define MDESC_PRO_VIS   0x20 /* Pronominalize visible monsters */
#define MDESC_SHOW   0x80 /* Assume the monster is visible */

Referenced by make_attack_normal(), and monster_desc().

#define MDESC_STANDARD   (MDESC_CAPITAL | MDESC_IND_HID | MDESC_PRO_HID)

Function Documentation

void get_mon_name ( char *  buf,
size_t  buflen,
const struct monster_race race,
int  num 
)

Helper function for display monlist.

Prints the number of creatures, followed by either a singular or plural version of the race name as appropriate.

References monster_race::flags, my_strcat(), monster_race::name, NULL, monster_race::plural, plural_aux(), rf_has, RF_UNIQUE, and strnfmt().

Referenced by monster_list_format_section().

void monster_desc ( char *  desc,
size_t  max,
const struct monster mon,
int  mode 
)

Builds a string describing a monster in some way.

We can correctly describe monsters based on their visibility. We can force all monsters to be treated as visible or invisible. We can build nominatives, objectives, possessives, or reflexives. We can selectively pronominalize hidden, visible, or all monsters. We can use definite or indefinite descriptions for hidden monsters. We can use definite or indefinite descriptions for visible monsters.

Pronominalization involves the gender whenever possible and allowed, so that by cleverly requesting pronominalization / visibility, you can get messages like "You hit someone. She screams in agony!".

Reflexives are acquired by requesting Objective plus Possessive.

Note that the "possessive" for certain unique monsters will look really silly, as in "Morgoth, King of Darkness's". We should perhaps add a flag to "remove" any "descriptives" in the name.

Note that "offscreen" monsters will get a special "(offscreen)" notation in their name if they are visible but offscreen. This may look silly with possessives, as in "the rat's (offscreen)". Perhaps the "offscreen" descriptor should be abbreviated.

Mode Flags: 0x01 –> Objective (or Reflexive) 0x02 –> Possessive (or Reflexive) 0x04 –> Use indefinites for hidden monsters ("something") 0x08 –> Use indefinites for visible monsters ("a kobold") 0x10 –> Pronominalize hidden monsters 0x20 –> Pronominalize visible monsters 0x40 –> Assume the monster is hidden 0x80 –> Assume the monster is visible 0x100 –> Capitalise monster name

Useful Modes: 0x00 –> Full nominative name ("the kobold") or "it" 0x04 –> Full nominative name ("the kobold") or "something" 0x80 –> Banishment resistance name ("the kobold") 0x88 –> Killing name ("a kobold") 0x22 –> Possessive, genderized if visable ("his") or "its" 0x23 –> Reflexive, genderized if visable ("himself") or "itself"

References monster_race::flags, monster::fx, monster::fy, is_a_vowel(), MDESC_CAPITAL, MDESC_HIDE, MDESC_IND_VIS, MDESC_OBJE, MDESC_POSS, MDESC_PRO_HID, MDESC_PRO_VIS, MDESC_SHOW, monster_is_visible(), my_strcap(), my_strcat(), my_strcpy(), monster_race::name, NULL, panel_contains(), monster::race, rf_has, and RF_UNIQUE.

Referenced by context_menu_cave(), do_cmd_walk_test(), effect_handler_DAMAGE(), effect_handler_DRAIN_MANA(), effect_handler_EARTHQUAKE(), effect_handler_MON_HEAL_HP(), effect_handler_MON_HEAL_KIN(), effect_handler_PROBE(), make_attack_normal(), make_attack_spell(), mon_set_timed(), mon_take_hit(), monster_reduce_sleep(), monster_take_terrain_damage(), process_monster(), process_monster_try_push(), project_p(), py_attack_real(), ranged_helper(), spell_message(), target_set_closest(), and target_set_interactive_aux().

void plural_aux ( char *  name,
size_t  max 
)

Perform simple English pluralization on a monster name.

References my_strcat().

Referenced by get_mon_name(), and get_subject().