52 if (tmp->type ==
SPELL && (!skill || tmp->skill == skill))
62 if (tmp->type ==
SPELL && (!skill || tmp->skill == skill)) {
97 if (caster == op && spob->
skill)
99 else if (caster->
skill)
112 if (at->clone.type ==
SPELL) {
113 fprintf(stderr,
"%s:%s:%s:%s:%d\n", at->clone.name ? at->clone.name :
"null",
114 at->name, at->clone.other_arch ? at->clone.other_arch->name :
"null",
115 at->clone.skill ? at->clone.skill :
"null", at->clone.level);
120 if (at->clone.type ==
SPELL && at->clone.path_attuned == 0) {
123 fprintf(stderr,
"Spells with no path set:\n");
126 fprintf(stderr,
"- %s\n", at->clone.name ? at->clone.name :
"null");
173 new_level = spell->
level 176 return MAX(new_level, 1);
201 level = skill->
level;
266 return MAX(sp, grace);
272 LOG(
llevError,
"SP_level_spellpoint_cost: Unknown flags passed: %d\n", flags);
411 object *spob1 = NULL, *spob2 = NULL;
422 if (spob->type ==
SPELL) {
423 if (!strncmp(spob->name, spname, strlen(spname))) {
424 if (strlen(spname) == strlen(spob->name))
429 }
else if (!strncmp(spob->name, spname, strlen(spob->name))) {
436 LOG(
llevError,
"Found multiple spells with overlapping base names: %s, %s\n", spob2->name, spob->name);
446 if (spob1 && nummatch == 1)
502 "Something is in the way. You cast it at your feet.");
557 && (tmp->type !=
BOW)
558 && (tmp->type !=
ARROW)
559 && (tmp->type !=
GOLEM)
573 if (tmp->type == op->
type 634 if (dir < 0 || dir > 8) {
635 LOG(
llevError,
"Invalid direction %d in fire_arch_from_position for %s\n", dir, spell->
name);
643 LOG(
llevError,
"Unexpected object type %d in fire_arch_from_position for %s\n", spell->
type, spell->
name);
656 if (mflags&P_OUT_OF_MAP) {
681 LOG(
llevError,
"Unexpected object subtype %d in fire_arch_from_position for %s\n", spell->
subtype, spell->
name);
690 "You can't cast the spell on top of a wall!");
721 if (mflags&P_OUT_OF_MAP) {
855 for (inv = tmp->
inv; inv; inv = inv->
below) {
890 int owner_type = 0, mflags;
895 if (exclude != NULL) {
896 exclude =
HEAD(exclude);
897 owner_type = exclude->
type;
940 object *tmp, *head = NULL, *prev = NULL;
1008 for (i = 0; i < n; i++)
1053 const char *godname;
1057 if (!strcmp(godname,
"none"))
1058 godname =
"Your spirit";
1060 if (failure <= -20 && failure > -40) {
1062 "%s gives a sign to renew your faith.",
1067 }
else if (failure <= -40 && failure > -60) {
1069 "Your diety touches your mind!");
1071 }
else if (failure <= -60 && failure > -150) {
1073 "%s requires you to pray NOW. You comply, ignoring all else.",
1077 }
else if (failure <= -150) {
1109 if (failure <= -20 && failure > -40) {
1111 "Your spell causes an unexpected effect.");
1115 }
else if (failure <= -40 && failure > -60) {
1117 "Your magic recoils on you, making you confused!");
1119 }
else if (failure <= -60 && failure > -80) {
1121 "Your magic stuns you!");
1123 }
else if (failure <= -80) {
1129 "The magic warps and you are turned inside out!");
1133 "You lose control of the mana! The uncontrolled magic blasts you!");
1187 object *first = NULL;
1202 count =
rndm(0, count-1);
1203 for (item = first; item; item = item->
below) {
1236 "Your %s turns to a flower!",
1260 if (second >= first)
1265 "You suddenly feel really weird!");
1311 char *ingredients[10];
1331 for (i = 0; i < count; i++) {
1334 while (isdigit(*ingredients[i])) {
1335 nrof[i] = 10*nrof[i]+(*(ingredients[i])-
'0');
1340 while (*ingredients[i] ==
' ')
1346 if (check->title == NULL)
1347 name2 = check->name;
1349 snprintf(name_ob,
sizeof(name_ob),
"%s %s", check->name, check->title);
1353 if (strcmp(name2, ingredients[i]) == 0) {
1359 if (found[i] == NULL) {
1362 "Casting this spell requires %s, but you don't have any.",
1368 if (found[i]->nrof < nrof[i]) {
1371 "Casting this spell requires %d %s, but you only have %d.",
1372 nrof[i], found[i]->name_pl, found[i]->nrof);
1381 for (i = 0; i < count; i++) {
1425 const char *godname;
1426 int success = 0, mflags, cast_level = 0;
1428 object *
skill = NULL;
1429 int confusion_effect = 0;
1430 float cost_multiplier = 1.0f;
1435 LOG(
llevError,
"cast_spell: null spell object passed\n");
1439 if (!strcmp(godname,
"none"))
1440 godname =
"A random spirit";
1444 LOG(
llevError,
"cast_spell: null caster object passed\n");
1452 if (
rndm(0, 5) < 4) {
1456 "In your confused state, you're not sure of what you cast!");
1459 confusion_effect = 1;
1467 "That spell path is denied to you.");
1490 if ((mflags&P_NO_CLERIC) && spell_ob->
stats.
grace)
1492 "This ground is unholy! %s ignores you.",
1498 "Something blocks your spellcasting.");
1503 "Something blocks the magic of your item.");
1507 "Something blocks the magic of your scroll.");
1527 if (spell_ob->
skill) {
1532 "You need the skill %s to cast %s.",
1538 "You lack enough skill to cast that spell.");
1549 "You don't have enough mana.");
1557 "%s grants your prayer, though you are unworthy.",
1563 "%s ignores your prayer.",
1574 "You fumble the spell.");
1580 if (bungle->
arch != NULL) {
1583 LOG(
llevError,
"cast_spell: Could not create spell_bungle arch\n");
1586 }
else if (spell_ob->
stats.
sp) {
1592 "You bungle the spell because you have too much heavy equipment in use.");
1598 if (bungle->
arch != NULL) {
1601 LOG(
llevError,
"cast_spell: Could not create spell_bungle arch\n");
1617 op->
spell = spell_ob;
1630 "You are casting!");
1634 spell_ob = op->
spell;
1676 "You lack the skill %s to use the %s",
1677 caster->
skill, name);
1694 if (confusion_effect) {
1698 "In your confused state, you can't control the magic!");
1721 success =
write_rune(op, caster, spell_ob, dir, stringarg);
1725 success =
write_mark(op, spell_ob, stringarg);
1729 success =
fire_bolt(op, caster, dir, spell_ob);
1737 success =
cast_cone(op, caster, dir, spell_ob);
1758 if (success || op->
contr == NULL)
1785 success =
magic_wall(op, caster, dir, spell_ob);
1806 cast_level = caster->
level;
1808 cast_level = skill != NULL ? skill->
level : op->
level;
1809 success =
probe(op, caster, spell_ob, dir, cast_level);
1813 success =
cast_heal(op, caster, spell_ob, dir);
1829 success =
cast_bless(op, caster, spell_ob, dir);
1833 success =
cast_curse(op, caster, spell_ob, dir);
1839 cost_multiplier = 0.0f;
1844 success =
recharge(op, caster, spell_ob);
1854 "The spell fizzles");
1862 success =
alchemy(op, caster, spell_ob);
1885 "You lack the proper attunement to cast %s",
1893 success =
fire_swarm(op, caster, spell_ob, dir);
1919 success =
cast_light(op, caster, spell_ob, dir);
1988 snprintf(dur,
sizeof(dur),
"%d", i);
1992 snprintf(dur,
sizeof(dur),
"%d", i);
2014 if (spell->
duration == atoi(key)) {
2016 "The effects of your %s are draining out.", spell->
name);
2022 if (spell->
duration == atoi(key)) {
2024 "The effects of your %s are about to expire.", spell->
name);
int SP_level_wc_adjust(const object *caster, const object *spob)
Returns adjusted wc based on the caster and the spell.
#define AP_UNAPPLY
Item is to be remvoed.
#define AT_HOLYWORD
Damage based on race and caster's god.
void set_spell_skill(object *op, object *caster, object *spob, object *dest)
Utility function to assign the correct skill when casting.
int dispel_rune(object *op, object *skill, int dir)
Someone is trying to disarm a rune.
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
const char * determine_god(object *op)
Determines if op worships a god.
#define ARCH_SPELL_BUNGLE
Archetype when player bungles a spell.
#define MSG_TYPE_ITEM_CHANGE
Item has changed in some way.
void shuffle_attack(object *op)
This routine shuffles the attack of op to one of the ones in the list.
see doc/Developers/objects
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
#define MSG_TYPE_ITEM
Item related information.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
Spell-related defines: spellpath, subtypes, ...
#define AT_COUNTERSPELL
Cancels magic spells (524288) peterm@soda.berkeley.edu.
struct archetype * arch
Pointer to archetype.
int cast_raise_dead_spell(object *op, object *caster, object *spell, int dir, const char *arg)
This handles the raise dead / resurrection spells.
int min_casting_level(const object *caster, const object *spell)
This function takes a caster and spell and presents the effective level the caster needs to be to cas...
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void esrv_send_item(object *pl, object *op)
Sends item's info to player.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
int SP_level_range_adjust(const object *caster, const object *spob)
Adjust the range of the spell based on level.
int8_t direction
Means the object is moving that way.
void spell_effect(object *spob, int x, int y, mapstruct *map, object *originator)
Inserts into map a spell effect based on other_arch.
#define FABS(x)
Decstations have trouble with fabs()...
int rndm(int min, int max)
Returns a number between min and max.
#define OB_TYPE_MOVE_BLOCK(ob1, type)
Basic macro to see if if ob1 can not move onto a space based on the 'type' move_block parameter Add c...
int cast_change_ability(object *op, object *caster, object *spell_ob, int dir, int silent)
Cast some stat-improving spell.
#define SP_CHANGE_MAP_LIGHT
#define AT_INTERNAL
Only used for internal calculations.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define SP_CHANGE_ABILITY
uint8_t spellpoint_level_depend
Spell costs go up with level.
#define P_NO_MAGIC
Spells (some) can't pass this object.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
int cast_bless(object *op, object *caster, object *spell_ob, int dir)
Improve statistics of some living object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
void object_update_turn_face(object *op)
If an object with the IS_TURNABLE() flag needs to be turned due to the closest player being on the ot...
#define MSG_TYPE_SPELL
Spell related info.
int16_t maxgrace
Maximum grace.
object * below
Pointer to the object stacked below this one.
#define MSG_TYPE_SPELL_FAILURE
Spell failure messages.
void dump_spells(void)
Dumps all the spells - now also dumps skill associated with the spell.
#define SP_ANIMATE_WEAPON
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
#define HUGE_BUF
Used for messages - some can be quite long.
#define SET_ANIMATION(ob, newanim)
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
int cast_smite_spell(object *op, object *caster, int dir, object *spell)
The priest points to a creature and causes a 'godly curse' to descend.
#define MSG_TYPE_SPELL_INFO
random info about spell, not related to failure/success
object * more
Pointer to the rest of a large body of objects.
sstring slaying
Which race to do double damage to.
int32_t value
How much money it is worth (or contains)
struct Statistics statistics
Merged spell statistics.
object * above
Pointer to the object stacked above this one.
int object_find_first_free_spot(const object *ob, mapstruct *m, int x, int y)
object_find_first_free_spot(archetype, mapstruct, x, y) works like object_find_free_spot(), but it will search max number of squares.
#define FLAG_CONFUSED
Will also be unable to cast spells.
int cast_word_of_recall(object *op, object *caster, object *spell_ob)
Word of recall causes the player to return 'home'.
#define MSG_TYPE_SKILL_MISSING
Don't have the skill.
int16_t y
Position in the map for this object.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
#define PATH_TIME_MULT(op, spell)
Multiplier for the casting time based on path attenuation.
#define OUT_OF_REAL_MAP(M, X, Y)
Checks if a square is out of the map.
int ok_to_put_more(mapstruct *m, int16_t x, int16_t y, object *op, uint32_t immune_stop)
Returns true if it is ok to put spell op on the space/may provided.
int16_t duration
Number of moves (see 'speed') spell lasts.
void draw_magic_map(object *pl)
Creates and sends magic map to player.
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...
int create_bomb(object *op, object *caster, int dir, object *spell)
Create a bomb.
int cast_item_curse_or_bless(object *op, object *spell_ob)
This alters player's marked item's cursed or blessed status, based on the spell_ob's fields...
uint32_t path_repelled
Paths the object is repelled from.
#define FLAG_REFLECTING
Object reflects from walls (lightning)
#define SP_CREATE_MISSILE
Global type definitions and header inclusions.
struct player * contr
Pointer to the player which control this object.
int recharge(object *op, object *caster, object *spell_ob)
Recharge wands.
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).
int SP_level_duration_adjust(const object *caster, const object *spob)
Adjust the duration of the spell based on level.
#define MSG_TYPE_APPLY
Applying objects.
static void handle_spell_confusion(object *op)
This does a random effect for op, which tried to cast a spell in a confused state.
uint8_t casting_time
It takes awhile to cast a spell.
#define MSG_TYPE_VICTIM_SPELL
Someone cast a bad spell on the player.
tag_t * spell_tags
Tags used for spell effect merging.
#define SP_WORD_OF_RECALL
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW)...
archetype * try_find_archetype(const char *name)
int cast_cone(object *op, object *caster, int dir, object *spell)
Casts a cone spell.
int32_t weight
Attributes of the object.
static void transmute_item_to_flower(object *op)
This transforms one random item of op to a flower.
int cast_create_food(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
Create food.
void spell_failure(object *op, int failure, int power, object *skill)
Handles the various effects for differing degrees of failure badness.
object * find_applied_skill_by_name(const object *op, const char *name)
Find a skill by name using the last_skill_ob list.
void check_bullet(object *op)
Checks to see what op should do, given the space it is on (eg, explode, damage player, etc).
rangetype shoottype
Which range-attack is being used by player.
int get_cleric_chance(int stat)
void esrv_del_item(player *pl, object *ob)
Tells the client to delete an item.
AssetsManager * getManager()
int probe(object *op, object *caster, object *spell_ob, int dir, int level)
Try to get information about a living thing.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
method_ret ob_process(object *op)
Processes an object, giving it the opportunity to move or react.
int16_t level
Level of creature or object.
int spell_find_dir(mapstruct *m, int x, int y, object *exclude)
Search what direction a spell should go in, first the center square then some close squares in the gi...
object * spell
Spell that was being cast.
object * object_decrease_nrof(object *op, uint32_t i)
Decreases a specified number from the amount of an object.
#define AT_GODPOWER
Adds relevant god's attacktype (1048576) peterm@soda.berkeley.edu.
int cast_curse(object *op, object *caster, object *spell_ob, int dir)
Curse an object, reducing its statistics.
int fire_swarm(object *op, object *caster, object *spell, int dir)
The following routine creates a swarm of objects.
size_t split_string(char *str, char *array[], size_t array_size, char sep)
Splits a string delimited by passed in sep value into characters into an array of strings...
int16_t casting_time
Time left before spell goes off.
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 FLAG_ALIVE
Object can fight (or be fought)
void confuse_living(object *op, object *hitter, int dam)
Confuse a living thing.
#define AP_IGNORE_CURSE
Apply/unapply regardless of cursed/damned status.
#define FLAG_REFL_SPELL
Spells (some) will reflect from object.
int cast_create_obj(object *op, object *new_op, int dir)
Creates object new_op in direction dir or if that is blocked, beneath the player (op).
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
#define SP_ITEM_CURSE_BLESS
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
int fire_arch_from_position(object *op, object *caster, int16_t x, int16_t y, int dir, object *spell)
Fires an archetype.
int summon_hostile_monsters(object *op, int n, const char *monstername)
Summons hostile monsters and places them in nearby squares.
#define MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN
Protections in this.
int8_t range
Range of the spell.
float speed
Frequency of object 'moves' relative to server tick rate.
int16_t encumbrance
How much our player is encumbered.
static int can_be_transmuted_to_flower(object *op)
Determines if an item can be transmuted after a cast failure.
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...
static bool IS_PLAYER(object *op)
object * env
Pointer to the object which is the environment.
#define QUERY_FLAG(xyz, p)
sstring anim_suffix
Used to determine combined animations.
#define MSG_TYPE_APPLY_ERROR
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
void query_name(const object *op, char *buf, size_t size)
Describes an item.
int perceive_self(object *op)
Living thing wants to know information.
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().
int pets_summon_golem(object *op, object *caster, int dir, object *spob)
Summons a monster.
int cast_light(object *op, object *caster, object *spell, int dir)
Illuminates something on a map, or try to blind a living thing.
object * head
Points to the main object of a large body.
#define MSG_TYPE_SPELL_ERROR
Spell failure messages.
int caster_level(const object *caster, const object *spell)
This function returns the effective level the spell is being cast at.
void get_search_arr(int *search_arr)
New function to make monster searching more efficient, and effective! This basically returns a random...
int write_mark(object *op, object *spell, const char *msg)
This writes a rune that contains the appropriate message.
uint8_t range_modifier
How going up in level affects range.
#define OB_SPELL_TAG_MATCH(op, count)
Check whether a tag matches in the tags.
Archetypes * archetypes()
Get archetypes.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
const Face * face
Face with colors.
object * find_random_spell_in_ob(object *ob, const char *skill)
This returns a random spell from 'ob'.
#define AP_NOPRINT
Don't print messages - caller will do that may be some that still print.
uint8_t dam_modifier
How going up in level affects damage.
void paralyze_living(object *op, int dam)
Paralyze a living thing.
#define P_OUT_OF_MAP
This space is outside the map.
#define GET_MAP_MOVE_BLOCK(M, X, Y)
Gets the blocking state of a square.
struct Settings settings
Global settings.
static void prayer_failure(object *op, int failure, int power)
Called when a player fails at casting a prayer.
#define MSG_TYPE_SKILL_FAILURE
Failure in using skill.
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
Check if the given object (usually a player) is standing on a battleground tile.
int cast_detection(object *op, object *caster, object *spell)
Detect magic or invisible items.
void cast_magic_storm(object *op, object *tmp, int lvl)
This is really used mostly for spell fumbles and the like.
#define FREE_AND_CLEAR_STR(xyz)
Release the shared string, and set it to NULL.
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.
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
wonder is really just a spell that will likely cast another spell.
#define HEAD(op)
Returns the head part of an object.
uint32_t path_denied
Paths the object is denied access to.
int freedir[SIZEOFFREE]
Direction we're pointing on this spot.
int cast_invisible(object *op, object *caster, object *spell_ob)
Makes the player or character invisible.
#define FLAG_WIZ
Object has special privilegies.
int write_rune(object *op, object *caster, object *spell, int dir, const char *runename)
Player is attempting to write a magical rune.
int isqrt(int n)
Compute the square root.
living stats
Str, Con, Dex, etc.
int cast_consecrate(object *op, object *caster, object *spell)
A spell to make an altar your god's.
#define MAX_BUF
Used for all kinds of things.
int16_t invisible
How much longer the object will be invis.
int cast_transfer(object *op, object *caster, object *spell, int dir)
This spell transfers sp from the player to another person.
float speed_left
How much speed is left to spend this round.
int dimension_door(object *op, object *caster, object *spob, int dir)
Teleport through some doors and space.
struct mapstruct * map
Pointer to the map in which this object is present.
int reflwall(mapstruct *m, int x, int y, object *sp_op)
Decides weither the (spell-)object sp_op will be reflected from the given mapsquare.
int cast_destruction(object *op, object *caster, object *spell_ob)
Hit all monsters around the caster.
int SP_level_dam_adjust(const object *caster, const object *spob)
Returns adjusted damage based on the caster.
short freearr_y[SIZEOFFREE]
Y offset when searching around a spot.
static const flag_definition flags[]
Flag mapping.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
#define SP_DIMENSION_DOOR
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
#define SPELL_TAG_SIZE
Defines default size of the *spell_tags pointer.
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.
int tailor_god_spell(object *spellop, object *caster)
Changes the attributes of cone, smite, and ball spells as needed by the code.
Chaos_Attacks ATTACKS[22]
Some local definitions for shuffle_attack().
#define FLAG_ANIMATE
The object looks at archetype for faces.
Object structure, the core of Crossfire.
int cast_cause_disease(object *op, object *caster, object *spell, int dir)
Let's try to infect something.
#define FLAG_GENERATOR
Will generate type ob->stats.food.
int cast_heal(object *op, object *caster, object *spell, int dir)
Heals something.
static event_registration m
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound for specified player only.
void rod_adjust(object *rod)
Adjusts rod attributes.
int cast_create_missile(object *op, object *caster, object *spell, int dir, const char *stringarg)
Create a missile (nonmagic - magic +4).
int mood_change(object *op, object *caster, object *spell)
This covers the various spells that change the moods of monsters - makes them angry, peaceful, friendly, etc.
#define FLAG_WIZCAST
The wizard can cast spells in no-magic area.
sstring name
The name of the object, obviously...
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
int remove_curse(object *op, object *caster, object *spell)
This function removes the cursed/damned status on equipped items.
uint32_t nrof
Number of objects.
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_...
int cast_earth_to_dust(object *op, object *caster, object *spell_ob)
Basically destroys earthwalls in the area.
int cast_change_map_lightlevel(object *op, object *spell)
This changes the light level for the entire map.
uint64_t spell_suppressions
Number of times ok_to_put_more() returned FALSE.
#define CLEAR_FLAG(xyz, p)
uint8_t type
PLAYER, BULLET, etc.
rangetype
What range is currently selected by the player.
int fire_bolt(object *op, object *caster, int dir, object *spob)
Cast a bolt-like spell.
#define FLAG_APPLIED
Object is ready for use by living.
char * spellarg
Optional argument when casting obj::spell.
void object_update_speed(object *op)
Updates the speed of an object.
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
Recursive routine to see if we can find a path to a certain point.
int object_set_value(object *op, const char *key, const char *value, int add_key)
Updates the key in op to value.
#define SP_SUMMON_MONSTER
object * inv
Pointer to the first object in the inventory.
#define FLAG_STARTEQUIP
Object was given to player at start.
#define AT_MAGIC
All magic spells, but not prayers (2)
void drain_rod_charge(object *rod)
Drain charges from a rod.
int alchemy(object *op, object *caster, object *spell_ob)
Change items to gold nuggets.
void object_copy_owner(object *op, object *clone)
Set the owner to clone's current owner and set the skill and experience objects to clone's objects (t...
#define GET_MAP_OB(M, X, Y)
Gets the bottom object on a map.
#define FORCE_TRANSFORMED_ITEM
static void swap_random_stats(object *op)
Randomly swaps 2 stats of op.
sstring skill
Name of the skill this object uses/grants.
int16_t maxsp
Max spell points.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
#define ARCH_SPELL_BLOCKED
Archetype when a spell is blocked (unholy ground or non magic).
int animate_weapon(object *op, object *caster, object *spell, int dir)
Generalization of staff_to_snake().
#define MSG_TYPE_SKILL
Messages related to skill use.
#define NDI_UNIQUE
Print immediately, don't buffer.
C function wrappers to interact with assets.
void drain_wand_charge(object *wand)
Drains a charge from a wand.
static int put_a_monster(object *op, const char *monstername)
Puts a monster named monstername near by op.
archetype * more
Next part of a linked object.
void check_spell_expiry(object *spell)
Checks if player should be warned of soon expiring spell.
int pets_summon_object(object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
General purpose summoning function.
object * find_target_for_friendly_spell(object *op, int dir)
This function is commonly used to find a friendly target for spells such as heal or protection or arm...
int absdir(int d)
Computes an absolute direction.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int32_t food
How much food in stomach.
object * lookup_spell_by_name(object *op, const char *spname)
Look at object 'op' and see if they know the spell spname.
void store_spell_expiry(object *spell)
Stores in the spell when to warn player of expiration.
Structure containing object statistics.
#define P_BLOCKSVIEW
This spot blocks the player's view.
int16_t maxhp
Max hit points.
uint8_t subtype
Subtype of object.
uint16_t difficulty
What level the player should be to play here.
static int spell_consume_items(object *op, const object *spell_ob)
Check if the player attempting to cast a spell has the required items, and eat those.
object * object_get_player_container(object *op)
Finds the player carrying an object.
void regenerate_rod(object *rod)
Regenerates a rod's charges.
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.
int cast_spell(object *op, object *caster, int dir, object *spell_ob, char *stringarg)
Main dispatch when someone casts a spell.
void query_short_name(const object *op, char *buf, size_t size)
query_short_name(object) is similar to query_name(), but doesn't contain any information about object...
uint8_t spell_failure_effects
Nasty backlash to spell failures.
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level...
int cast_create_town_portal(object *op, object *caster, object *spell)
This function cast the spell of town portal for op.
int cast_identify(object *op, object *caster, object *spell)
Identifies objects in the players inventory/on the ground.
object clone
An object from which to do object_copy()
uint8_t duration_modifier
how level modifies duration
#define P_NO_CLERIC
No clerical spells cast here.
int create_aura(object *op, object *caster, object *spell)
Create an aura spell object and put it in the player's inventory.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
int cast_polymorph(object *op, object *caster, object *spell_ob, int dir)
Polymorph spell casting.
uint32_t path_attuned
Paths the object is attuned to.
int magic_wall(object *op, object *caster, int dir, object *spell_ob)
This creates magic walls.
#define PATH_SP_MULT(op, spell)
Multiplier for spell points / grace based on the attenuation.
void each(std::function< void(T *)> op)
Apply a function to each asset.