28 #define sqr(x) ((x)*(x)) 50 int write_rune(
object *op,
object *caster,
object *spell,
int dir,
const char *runename) {
51 object *rune_spell, *rune;
66 "Can't make a rune there!");
70 if (tmp->type ==
RUNE) {
72 "You can't write a rune there.");
84 int bestmatch = 0, ms;
86 if (!runename || *runename == 0) {
88 "Write a rune of what?");
94 if (tmp->type ==
SPELL) {
105 "You don't know any spell named %s",
112 "You can't cast %s with %s",
118 "%s belongs to a spell path denied to you.",
124 "%s is beyond your ability to cast!",
130 "You don't have enough mana.");
136 "You don't have enough grace.");
149 snprintf(buf,
sizeof(buf),
"You set off a rune of %s\n", rune_spell->
name);
158 snprintf(buf, 100,
"%s.111", spell->
name);
161 if (face_override != NULL && anim_override != NULL) {
162 rune->
face = face_override;
194 object *disease = op->
inv;
321 "There's nothing there!");
337 if (tmp->type ==
RUNE || tmp->type ==
TRAP) {
346 if (tmp->type ==
SIGN && !strcmp(tmp->arch->name,
"rune_mark")) {
350 "You wipe out the rune of marking!");
367 "There's nothing there!");
442 int trap_disarm(
object *disarmer,
object *trap,
int risk,
object *skill) {
455 "You successfully disarm the %s!",
462 if (owner != NULL && owner->
type !=
PLAYER && risk)
469 "You fail to disarm the %s.",
475 "In fact, you set it off!");
#define FLAG_IS_LINKED
The object is linked with other objects.
Spell-related defines: spellpath, subtypes, ...
This is used by get_rangevector to determine where the other creature is.
This represents one animation.
int dispel_rune(object *op, object *skill, int dir)
Someone is trying to disarm a rune.
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
int8_t direction
Means the object is moving that way.
#define MSG_TYPE_COMMAND_FAILURE
Failed result from command.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
int write_rune(object *op, object *caster, object *spell, int dir, const char *runename)
Player is attempting to write a magical rune.
#define MSG_TYPE_APPLY_TRAP
Have activated a trap.
int trap_disarm(object *disarmer, object *trap, int risk, object *skill)
Try to disarm a trap/rune.
object * object_find_by_type2(const object *who, int type1, int type2)
Find object in inventory.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
#define MSG_TYPE_SPELL
Spell related info.
New face structure - this enforces the notion that data is face by face only - you can not change the...
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
int16_t SP_level_spellpoint_cost(object *caster, object *spell, int flags)
Scales the spellpoint cost of a spell by it's increased effectiveness.
#define GET_ANIMATION(ob, anim)
int16_t y
Position in the map for this object.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
void spring_trap(object *trap, object *victim)
This function generalizes attacks by runes/traps.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects...
Global type definitions and header inclusions.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
#define MSG_TYPE_APPLY
Applying objects.
bool chance(int a, int b)
Return true with a probability of a/b.
static std::shared_ptr< inja::Environment > env
Rendering environment.
#define FLAG_IS_USED_UP
When (–food<0) the object will exit.
const Face * try_find_face(const char *name, const Face *error)
int16_t level
Level of creature or object.
int object_matches_string(object *pl, object *op, const char *name)
This is a subset of the parse_id command.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
#define FLAG_ALIVE
Object can fight (or be fought)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
#define MSG_TYPE_SPELL_SUCCESS
Spell succeeded messages.
#define MSG_TYPE_COMMAND_SUCCESS
Successful result from command.
static void rune_attack(object *op, object *victim)
This function handles those runes which detonate but do not cast spells.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
#define QUERY_FLAG(xyz, p)
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
short freearr_x[SIZEOFFREE]
X offset when searching around a spot.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
sstring msg
If this is a book/sign/magic mouth/etc.
#define MSG_TYPE_SPELL_ERROR
Spell failure messages.
const Animations * animation
Animation of this item, NULL if not animated.
int hit_map(object *op, int dir, uint32_t type, int full_hit)
Attack a spot on the map.
int infect_object(object *victim, object *disease, int force)
Try to infect something with a disease.
const Face * face
Face with colors.
#define P_OUT_OF_MAP
This space is outside the map.
object * object_get_env_recursive(object *op)
Utility function.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it...
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
uint32_t tag_t
Object tag, unique during the whole game.
int16_t dam
How much damage this object does when hitting.
uint32_t path_denied
Paths the object is denied access to.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
const Animations * temp_animation
A temporary animation.
int trap_see(object *op, object *trap)
Should op see trap?
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
struct mapstruct * map
Pointer to the map in which this object is present.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
struct treasurelist * randomitems
Items to be generated.
static event_registration m
Animations * try_find_animation(const char *name)
sstring name
The name of the object, obviously...
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_...
void destroy_object(object *op)
Recursively object_free_drop_inventory() op and its inventory.
unsigned int distance
Distance, in squares.
uint8_t type
PLAYER, BULLET, etc.
int trap_show(object *trap, object *where)
Handles showing a trap/rune detonation.
#define FLAG_LIFESAVE
Saves a players' life once, then destr.
int get_rangevector(object *op1, const object *op2, rv_vector *retval, int flags)
From map.c This is used by get_player to determine where the other creature is.
object * inv
Pointer to the first object in the inventory.
sstring skill
Name of the skill this object uses/grants.
uint32_t attacktype
Bitmask of attacks this object does.
#define NDI_UNIQUE
Print immediately, don't buffer.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int32_t food
How much food in stomach.
int16_t maxhp
Max hit points.
uint16_t difficulty
What level the player should be to play here.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
tag_t count
Unique object number for this object.
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
object clone
An object from which to do object_copy()
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
uint32_t path_attuned
Paths the object is attuned to.