Crossfire Server, Branch 1.12  R12190
Functions | Variables
spell_effect.c File Reference

Various spell effects, non attacks. More...

#include <global.h>
#include <object.h>
#include <living.h>
#include <sproto.h>
#include <spells.h>
#include <sounds.h>
Include dependency graph for spell_effect.c:

Go to the source code of this file.

Functions

int alchemy (object *op, object *caster, object *spell_ob)
 Change items to gold nuggets.
static void alchemy_object (float value_adj, object *obj, int *small_nuggets, int *large_nuggets, int *weight)
 Compute how many nuggets an object is worth, and remove it.
int animate_weapon (object *op, object *caster, object *spell, int dir)
 Generalization of staff_to_snake().
int cast_bless (object *op, object *caster, object *spell_ob, int dir)
 Improve statistics of some living object.
int cast_change_ability (object *op, object *caster, object *spell_ob, int dir, int silent)
 Cast some stat-improving spell.
int cast_change_map_lightlevel (object *op, object *caster, object *spell)
 This changes the light level for the entire map.
int cast_consecrate (object *op, object *caster, object *spell)
 A spell to make an altar your god's.
int cast_create_food (object *op, object *caster, object *spell_ob, int dir, const char *stringarg)
 Create food.
int cast_create_missile (object *op, object *caster, object *spell, int dir, const char *stringarg)
 Create a missile (nonmagic - magic +4).
int cast_create_town_portal (object *op, object *caster, object *spell, int dir)
 This function cast the spell of town portal for op.
int cast_detection (object *op, object *caster, object *spell)
 Detect magic or invisible items.
int cast_earth_to_dust (object *op, object *caster, object *spell_ob)
 Basically destroys earthwalls in the area.
int cast_heal (object *op, object *caster, object *spell, int dir)
 Heals something.
int cast_identify (object *op, object *caster, object *spell)
 Identifies objects in the players inventory/on the ground.
int cast_invisible (object *op, object *caster, object *spell_ob)
 Makes the player or character invisible.
int cast_item_curse_or_curse (object *op, object *caster, object *spell_ob)
 This alters player's marked item's cursed or blessed status, based on the spell_ob's fields.
void cast_magic_storm (object *op, object *tmp, int lvl)
 This is really used mostly for spell fumbles at the like.
int cast_polymorph (object *op, object *caster, object *spell_ob, int dir)
 Polymorph spell casting.
int cast_transfer (object *op, object *caster, object *spell, int dir)
 This spell transfers sp from the player to another person.
int cast_wonder (object *op, object *caster, int dir, object *spell_ob)
 wonder is really just a spell that will likely cast another spell.
int cast_word_of_recall (object *op, object *caster, object *spell_ob)
 Word of recall causes the player to return 'home'.
static void charge_mana_effect (object *victim, int caster_level)
 Checks if victim has overcharged mana, and if so does some fireball.
void counterspell (object *op, int dir)
 Nullifies spell effects.
int create_aura (object *op, object *caster, object *spell)
 Create an aura spell object and put it in the player's inventory.
int dimension_door (object *op, object *caster, object *spob, int dir)
 Teleport through some doors and space.
int magic_wall (object *op, object *caster, int dir, object *spell_ob)
 This creates magic walls.
int makes_invisible_to (object *pl, object *mon)
 This checks to see if 'pl' is invisible to 'mon'.
int perceive_self (object *op)
 Living thing wants to know information.
static void place_alchemy_objects (object *op, mapstruct *m, int small_nuggets, int large_nuggets, int x, int y)
 Place gold nuggets on the map.
void polymorph (object *op, object *who, int level)
 Handles polymorphing an object, living or not.
static void polymorph_item (object *who, object *op, int level)
 Changes an item to another item of similar type.
static void polymorph_living (object *op, int level)
 Takes a living object (op) and turns it into another monster of some sort.
static void polymorph_melt (object *who, object *op)
 Destroys item from polymorph failure.
int probe (object *op, object *caster, object *spell_ob, int dir)
 Try to get information about a living thing.
int recharge (object *op, object *caster, object *spell_ob)
 Recharge wands.
int remove_curse (object *op, object *caster, object *spell)
 This function removes the cursed/damned status on equipped items.
int write_mark (object *op, object *spell, const char *msg)
 This writes a rune that contains the appropriate message.

Variables

static object * large
 Nugget items.
static uint64 large_value
 Value of nuggets.
static const char *const no_gain_msgs [NUM_STATS]
 This is used for the spells that gain stats.
static object * small
static uint64 small_value

Detailed Description

Various spell effects, non attacks.

Todo:
use the same parameter names/orders.

Definition in file spell_effect.c.


Function Documentation

int alchemy ( object *  op,
object *  caster,
object *  spell_ob 
)

Change items to gold nuggets.

Only works for players.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
Return values:
0op isn't a player.
1op is a player.

Definition at line 2208 of file spell_effect.c.

References alchemy_object(), create_archetype(), F_TRUE, FLAG_ALIVE, FLAG_IS_CAULDRON, FLAG_NO_PICK, free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, large, large_value, MOVE_WALK, P_NO_MAGIC, P_OUT_OF_MAP, place_alchemy_objects(), PLAYER, query_cost(), QUERY_FLAG, small, small_value, SP_level_dam_adjust(), and SP_level_duration_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

static void alchemy_object ( float  value_adj,
object *  obj,
int *  small_nuggets,
int *  large_nuggets,
int *  weight 
) [static]

Compute how many nuggets an object is worth, and remove it.

Parameters:
value_adjhow much to adjust the cost of obj.
objobject to convert.
[out]small_nuggetshow many small nuggets obj gives.
[out]large_nuggetshow many large nuggets obj gives.
[out]weightthe weight of the object.

Definition at line 2109 of file spell_effect.c.

References F_TRUE, FLAG_UNPAID, free_object(), GEM, large_value, MONEY, query_cost(), QUERY_FLAG, remove_ob(), rndm(), and small_value.

Referenced by alchemy().

Here is the call graph for this function:

Here is the caller graph for this function:

int animate_weapon ( object *  op,
object *  caster,
object *  spell,
int  dir 
)

Generalization of staff_to_snake().

Makes a golem out of the caster's weapon. The golem is based on the archetype specified, modified by the caster's level and the attributes of the weapon. The weapon is inserted in the golem's inventory so that it falls to the ground when the golem dies. This code was very odd - code early on would only let players use the spell, yet the code wass full of player checks. I've presumed that the code that only let players use it was correct, and removed all the other player checks. MSW 2003-01-06

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
Return values:
0spell failure.
1spell was successful.

Definition at line 2954 of file spell_effect.c.

References add_friendly_object(), add_string(), arch_to_object(), AT_PHYSICAL, ATNR_BLIND, ATNR_CONFUSION, ATNR_DEATH, ATNR_DEPLETE, ATNR_FEAR, ATNR_PARALYZE, ATNR_PHYSICAL, ATNR_POISON, ATNR_SLOW, ATNR_TURN_UNDEAD, caster_level(), CLEAR_FLAG, control_golem(), draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_free_spot(), find_marked_object(), fix_object(), FLAG_ANIMATE, FLAG_APPLIED, FLAG_FRIENDLY, FLAG_MONSTER, FLAG_REMOVED, FLAG_UNPAID, FLAG_USE_WEAPON, free_string(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, get_split_ob(), GOLEM, insert_ob_in_map(), insert_ob_in_ob(), llevError, LOG(), MAX, MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, name_to_material(), NDI_BLACK, NDI_UNIQUE, NROFATTACKS, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, query_name(), range_golem, remove_ob(), _materialtype::save, SET_FLAG, set_owner(), set_spell_skill(), snprintf(), SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), UPD_NROF, update_ob_speed(), and WEAPON.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_bless ( object *  op,
object *  caster,
object *  spell_ob,
int  dir 
)

Improve statistics of some living object.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
dircasting direction.
Return values:
0spell failed.
1spell was successful.

Definition at line 1965 of file spell_effect.c.

References add_refcount(), add_string(), AT_PHYSICAL, ATNR_GODPOWER, change_abil(), create_archetype(), determine_god(), draw_ext_info(), draw_ext_info_format(), find_god(), find_target_for_friendly_spell(), fix_object(), FLAG_APPLIED, FORCE, FORCE_CHANGE_ABILITY, FORCE_NAME, free_string(), insert_ob_in_ob(), MIN, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, MSG_TYPE_SPELL_TARGET, NDI_UNIQUE, NROFATTACKS, SET_FLAG, and SP_level_duration_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_change_ability ( object *  op,
object *  caster,
object *  spell_ob,
int  dir,
int  silent 
)

Cast some stat-improving spell.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
dircasting direction.
silentif non zero, don't say when the spell is already is effect.
Return values:
0spell failed.
1spell was successful.
Todo:
weird check on duration? since you'll never get there since a force would have been found?

Definition at line 1825 of file spell_effect.c.

References add_refcount(), change_abil(), CLEAR_FLAG, create_archetype(), draw_ext_info(), draw_ext_info_format(), find_target_for_friendly_spell(), FLAG_APPLIED, FLAG_NO_FIX_PLAYER, FLAG_SEE_IN_DARK, FLAG_XRAYS, FORCE, FORCE_CHANGE_ABILITY, FORCE_NAME, free_string(), get_attr_value(), insert_ob_in_ob(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, no_gain_msgs, NROFATTACKS, NUM_STATS, PLAYER, QUERY_FLAG, rndm(), set_attr_value(), SET_FLAG, SP_level_dam_adjust(), SP_level_duration_adjust(), and store_spell_expiry().

Referenced by cast_spell(), and god_intervention().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_change_map_lightlevel ( object *  op,
object *  caster,
object *  spell 
)

This changes the light level for the entire map.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Return values:
0light not affected.
1light changed.

Definition at line 3183 of file spell_effect.c.

References change_map_light(), draw_ext_info(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, and NDI_UNIQUE.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_consecrate ( object *  op,
object *  caster,
object *  spell 
)

A spell to make an altar your god's.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Return values:
0no consecration happened.
1an altar waas consecrated.

Definition at line 2873 of file spell_effect.c.

References arch_to_object(), caster_level(), determine_god(), draw_ext_info(), draw_ext_info_format(), find_archetype(), find_god(), FLAG_IS_FLOOR, HOLY_ALTAR, insert_ob_in_map(), llevError, LOG(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, QUERY_FLAG, remove_ob(), snprintf(), and tolower.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_create_food ( object *  op,
object *  caster,
object *  spell_ob,
int  dir,
const char *  stringarg 
)

Create food.

Allows the choice of what sort of food object to make. If stringarg is NULL, it will create food dependent on level --PeterM

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
dircasting direction.
stringargoptional parameter specifying what kind of items to create.
Return values:
0no food created.
foodwas created.

Definition at line 639 of file spell_effect.c.

References cast_create_obj(), copy_object(), draw_ext_info(), DRINK, find_archetype_by_object_type_name(), first_archetype, FOOD, get_object(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, and SP_level_duration_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_create_missile ( object *  op,
object *  caster,
object *  spell,
int  dir,
const char *  stringarg 
)

Create a missile (nonmagic - magic +4).

Will either create bolts or arrows based on whether a crossbow or bow is equiped. If neither, it defaults to arrows. Sets the plus based on the casters level. It is also settable with the invoke command. If the caster attempts to create missiles with too great a plus, the default is used. The # of arrows created also goes up with level, so if a 30th level mage wants LOTS of arrows, and doesn't care what the plus is he could create nonnmagic arrows, or even -1, etc...

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
stringargoptional parameter specifying what kind of items to create.
Return values:
0no missile created.
missileswere created.

Definition at line 525 of file spell_effect.c.

References BOW, cast_create_obj(), create_archetype(), draw_ext_info_format(), find_archetype(), find_artifactlist(), FLAG_APPLIED, FLAG_IDENTIFIED, free_object(), give_artifact_abilities(), artifactstruct::item, artifactliststruct::items, llevDebug, LOG(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, NDI_UNIQUE, artifactstruct::next, pick_up(), PLAYER, QUERY_FLAG, SET_FLAG, SP_level_dam_adjust(), SP_level_duration_adjust(), and strcasecmp().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_create_town_portal ( object *  op,
object *  caster,
object *  spell,
int  dir 
)

This function cast the spell of town portal for op.

The spell operates in two passes. During the first one a place is marked as a destination for the portal. During the second one, 2 portals are created, one in the position the player cast it and one in the destination place. The portal are synchronized and 2 forces are inserted in the player to destruct the portal next time player creates a new portal pair. This spell has a side effect that it allows people to meet each other in a permanent, private, appartements by making a town portal from it to the town or another public place. So, check if the map is unique and if so return an error

Code by Tchize (david.delbecq@usa.net)

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
Return values:
0spell was insuccessful for some reason.
1spell worked.

Definition at line 1122 of file spell_effect.c.

References add_string(), arch_to_object(), cast_create_obj(), caster_level(), check_inv_recursive(), create_archetype(), Settings::create_home_portals, draw_ext_info(), EXIT_PATH, EXIT_X, EXIT_Y, find_archetype(), FREE_AND_COPY, free_object(), free_string(), insert_ob_in_map(), insert_ob_in_ob(), mapdef::last_reset_time, llevDebug, llevError, Settings::localdir, LOG(), MAP_PLAYER_UNIQUE, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_NAVY, NDI_UNIQUE, present_arch(), ready_map_name(), remove_ob(), settings, and snprintf().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_detection ( object *  op,
object *  caster,
object *  spell 
)

Detect magic or invisible items.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Returns:
1.

Definition at line 2500 of file spell_effect.c.

References ALTAR, arch_to_object(), AT_MAGIC, BOOK, BUTTON, caster_level(), CF_HANDLE, CLEAR_FLAG, determine_god(), esrv_send_item(), EXIT, find_god(), FLAG_ANIMATE, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_IS_FLOOR, FLAG_KNOWN_CURSED, FLAG_KNOWN_MAGICAL, FLAG_MAKE_INVIS, FLAG_MONSTER, FLAG_WIZ, GATE, get_map_flags(), GET_MAP_OB, HOLE, HOLY_ALTAR, insert_ob_in_map(), is_magical(), LOCKED_DOOR, P_OUT_OF_MAP, PLAYER, PREFER_HIGH, QUERY_FLAG, random_roll(), RUNE, SET_FLAG, SIGN, SP_level_range_adjust(), SPECIAL_KEY, TELEPORTER, TRAPDOOR, TREASURE, TRIGGER_PEDESTAL, and WEAPON.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_earth_to_dust ( object *  op,
object *  caster,
object *  spell_ob 
)

Basically destroys earthwalls in the area.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
Return values:
0op isn't a player.
1op is a player.

Definition at line 882 of file spell_effect.c.

References AT_PHYSICAL, FLAG_TEAR_DOWN, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, hit_player(), P_OUT_OF_MAP, PLAYER, QUERY_FLAG, and SP_level_range_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_heal ( object *  op,
object *  caster,
object *  spell,
int  dir 
)

Heals something.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
Todo:
check spurious cure_disease call (shouldn't the spell's level be sent?) and return check value (always 1).

Definition at line 1679 of file spell_effect.c.

References AT_BLIND, AT_CONFUSION, AT_DISEASE, AT_POISON, cure_disease(), draw_ext_info(), find_archetype(), find_target_for_friendly_spell(), FORCE, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_HEAL, NDI_UNIQUE, PREFER_HIGH, present_arch_in_ob(), present_in_ob_by_name(), and random_roll().

Referenced by cast_spell(), and god_intervention().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_identify ( object *  op,
object *  caster,
object *  spell 
)

Identifies objects in the players inventory/on the ground.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Return values:
0nothing was identified.
1at least one object was identified.

Definition at line 2419 of file spell_effect.c.

References draw_ext_info(), draw_ext_info_format(), esrv_update_item(), FLAG_IDENTIFIED, GET_MAP_OB, identify(), MAX_BUF, MSG_TYPE_ITEM, MSG_TYPE_ITEM_INFO, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, need_identify(), ob_describe(), PLAYER, QUERY_FLAG, SP_level_dam_adjust(), spell_effect(), UPD_FLAGS, and UPD_NAME.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_invisible ( object *  op,
object *  caster,
object *  spell_ob 
)

Makes the player or character invisible.

Note the spells to 'stack', but perhaps in odd ways. the duration for all is cumulative. In terms of invis undead/normal invis, it is the last one cast that will determine if you are invisible to undead or normal monsters. For improved invis, if you cast it with a one of the others, you lose the improved part of it, and the above statement about undead/ normal applies.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
Return values:
0invisibility was already in action.
1op is now invisible.

Definition at line 821 of file spell_effect.c.

References active_objects, add_refcount(), draw_ext_info(), FLAG_MAKE_INVIS, FREE_AND_CLEAR_STR, makes_invisible_to(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, PLAYER, QUERY_FLAG, SP_level_duration_adjust(), and update_object().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_item_curse_or_curse ( object *  op,
object *  caster,
object *  spell_ob 
)

This alters player's marked item's cursed or blessed status, based on the spell_ob's fields.

Parameters:
opplayer casting the spell.
casterwhat object was used to cast the spell.
spell_obspell itself.
Returns:
1 if item was changed, 0 else.

Definition at line 2367 of file spell_effect.c.

References CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), esrv_update_item(), find_marked_object(), FLAG_BLESSED, FLAG_CURSED, FLAG_IDENTIFIED, FLAG_KNOWN_BLESSED, FLAG_KNOWN_CURSED, FLAG_STARTEQUIP, HUGE_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, QUERY_FLAG, query_short_name(), SET_FLAG, and UPD_FLAGS.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

void cast_magic_storm ( object *  op,
object *  tmp,
int  lvl 
)

This is really used mostly for spell fumbles at the like.

Parameters:
opwhat is casting this.
tmpobject to propogate.
lvlhow nasty should the propagation be.

Definition at line 55 of file spell_effect.c.

References insert_ob_in_map().

Referenced by alchemy_failure_effect(), become_follower(), god_examines_priest(), pray_at_altar(), prayer_failure(), and scroll_failure().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_polymorph ( object *  op,
object *  caster,
object *  spell_ob,
int  dir 
)

Polymorph spell casting.

Parameters:
opwho is casting the spell.
casterobject used to cast spell.
spell_obspell itself.
dircasting direction. 0 won't have any effect.
Returns:
Returns 0 on illegal cast, otherwise 1.

Definition at line 453 of file spell_effect.c.

References arch_to_object(), caster_level(), FLAG_IS_FLOOR, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, insert_ob_in_map(), MOVE_FLY_LOW, P_NO_MAGIC, P_OUT_OF_MAP, polymorph(), QUERY_FLAG, and SP_level_range_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_transfer ( object *  op,
object *  caster,
object *  spell,
int  dir 
)

This spell transfers sp from the player to another person.

We let the target go above their normal maximum SP.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
dircasting direction.
Return values:
0no transfer happened.
1transfer happened.

Definition at line 2726 of file spell_effect.c.

References caster_level(), charge_mana_effect(), draw_ext_info(), FLAG_ALIVE, freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_BLACK, P_IS_ALIVE, P_OUT_OF_MAP, QUERY_FLAG, and SP_level_dam_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_wonder ( object *  op,
object *  caster,
int  dir,
object *  spell_ob 
)

wonder is really just a spell that will likely cast another spell.

Parameters:
opwho is casting.
casterwhat is casting.
dircasting direction.
spell_obactual spell object.
Todo:
doesn't it decrease sp without checking?

Definition at line 997 of file spell_effect.c.

References cast_cone(), cast_spell(), generate_treasure(), llevError, LOG(), rndm(), SP_WONDER, and SPELL.

Referenced by cast_spell(), and scroll_failure().

Here is the call graph for this function:

Here is the caller graph for this function:

int cast_word_of_recall ( object *  op,
object *  caster,
object *  spell_ob 
)

Word of recall causes the player to return 'home'.

we put a force into the player object, so that there is a time delay effect.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obactual spell object.
Return values:
0op isn't a player.
1word of recall initiated.

Definition at line 935 of file spell_effect.c.

References add_string(), create_archetype(), draw_ext_info(), EXIT_PATH, EXIT_X, EXIT_Y, find_obj_by_type_subtype(), FORCE_NAME, insert_ob_in_ob(), llevError, LOG(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, PLAYER, SP_level_duration_adjust(), SP_WORD_OF_RECALL, SPELL_EFFECT, and update_ob_speed().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

static void charge_mana_effect ( object *  victim,
int  caster_level 
) [static]

Checks if victim has overcharged mana, and if so does some fireball.

Parameters:
victimwho may have overcharged.
caster_levelcaster's (skill) level whose spell did cause the overcharge.

Definition at line 2669 of file spell_effect.c.

References confuse_living(), create_archetype(), draw_ext_info(), EXPLODING_FIREBALL, insert_ob_in_map(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_TARGET, MSG_TYPE_VICTIM, MSG_TYPE_VICTIM_SPELL, NDI_ORANGE, NDI_UNIQUE, PREFER_LOW, and random_roll().

Referenced by cast_transfer().

Here is the call graph for this function:

Here is the caller graph for this function:

void counterspell ( object *  op,
int  dir 
)

Nullifies spell effects.

Basically, if the object has a magic attacktype, this may nullify it.

Parameters:
opcounterspell object.
dirdirection it was cast in.

Definition at line 2795 of file spell_effect.c.

References AT_COUNTERSPELL, AT_MAGIC, FLAG_MONSTER, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, P_OUT_OF_MAP, QUERY_FLAG, remove_ob(), rndm(), RUNE, and SPELL_EFFECT.

Referenced by hit_map().

Here is the call graph for this function:

Here is the caller graph for this function:

int create_aura ( object *  op,
object *  caster,
object *  spell 
)

Create an aura spell object and put it in the player's inventory.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Returns:
1.

Definition at line 3213 of file spell_effect.c.

References arch_to_object(), caster_level(), draw_ext_info(), insert_ob_in_ob(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, PLAYER, present_arch_in_ob(), set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), and store_spell_expiry().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int dimension_door ( object *  op,
object *  caster,
object *  spob,
int  dir 
)

Teleport through some doors and space.

Parameters:
opwho is casting.
casterwhat is casting.
spobactual spell object.
dircasting direction.
Return values:
0spell failure.
1spell was successful.

Definition at line 1551 of file spell_effect.c.

References draw_ext_info(), FABS, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), map_newmap_cmd(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, P_BLOCKSVIEW, P_IS_ALIVE, P_NO_MAGIC, P_OUT_OF_MAP, PLAYER, remove_ob(), and SP_level_range_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int magic_wall ( object *  op,
object *  caster,
int  dir,
object *  spell_ob 
)

This creates magic walls.

Really, it can create most any object, within some reason.

Parameters:
opwho is casting.
casterwhat is casting.
dircasting direction.
spell_obactual spell object.
Return values:
0spell failed.
1spell was successful.

Definition at line 1391 of file spell_effect.c.

References arch_to_object(), caster_level(), copy_object(), draw_ext_info(), draw_ext_info_format(), find_archetype(), FLAG_ALIVE, FLAG_BLOCKSVIEW, FLAG_IS_USED_UP, FLAG_TEAR_DOWN, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, get_object(), insert_ob_in_map(), insert_ob_in_ob(), llevError, LOG(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, P_IS_ALIVE, P_OUT_OF_MAP, QUERY_FLAG, SET_FLAG, set_owner(), set_spell_skill(), snprintf(), SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), SPELL, SPELL_EFFECT, and update_all_los().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int makes_invisible_to ( object *  pl,
object *  mon 
)

This checks to see if 'pl' is invisible to 'mon'.

Does race check, undead check, etc Returns TRUE if mon can't see pl, false otherwise. This doesn't check range, walls, etc. It only checks the racial adjustments, and in fact that pl is invisible.

Parameters:
plpotentially invisible object.
monwho may see pl.
Return values:
0mon can see pl.
1mon can't see pl.

Definition at line 774 of file spell_effect.c.

References FLAG_UNDEAD, is_true_undead(), PLAYER, and QUERY_FLAG.

Referenced by can_see_enemy(), and cast_invisible().

Here is the call graph for this function:

Here is the caller graph for this function:

int perceive_self ( object *  op)

Living thing wants to know information.

Parameters:
opwho wants information.
Returns:
1.

Definition at line 1031 of file spell_effect.c.

References change_resist_msg, describe_item(), determine_god(), draw_ext_info(), draw_ext_info_format(), find_archetype(), find_god(), FORCE, get_attr_value(), is_dragon_pl(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_PERCEIVE_SELF, NDI_UNIQUE, NUM_STATS, present_arch_in_ob(), snprintf(), statname, and VERY_BIG_BUF.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

static void place_alchemy_objects ( object *  op,
mapstruct m,
int  small_nuggets,
int  large_nuggets,
int  x,
int  y 
) [static]

Place gold nuggets on the map.

Parameters:
opplayer who is casting the spell. Just used so nuggets are inserted below her.
mmap to insert to.
small_nuggets
large_nuggetshow many nuggets to place.
x
ywhere to place the nuggets.

Definition at line 2166 of file spell_effect.c.

References copy_object(), get_object(), insert_ob_in_map(), large, and small.

Referenced by alchemy().

Here is the call graph for this function:

Here is the caller graph for this function:

void polymorph ( object *  op,
object *  who,
int  level 
)

Handles polymorphing an object, living or not.

Will avoid some specific items (flying arrows and such).

Parameters:
opobject being polymorphed.
whospell caster.
levelspell level.

Definition at line 399 of file spell_effect.c.

References FABS, FLAG_ALIVE, FLAG_ANIMATE, FLAG_GENERATOR, FLAG_MONSTER, FLAG_NO_PICK, PLAYER, polymorph_item(), polymorph_living(), polymorph_melt(), QUERY_FLAG, rndm(), and TREASURE.

Referenced by cast_polymorph().

Here is the call graph for this function:

Here is the caller graph for this function:

static void polymorph_item ( object *  who,
object *  op,
int  level 
) [static]

Changes an item to another item of similar type.

Parameters:
whospell caster.
opobject being polymorphed. Should be a non living thing.
levelspell level, required for monster resistance.

Definition at line 302 of file spell_effect.c.

References copy_object(), FABS, first_archetype, fix_generated_item(), FLAG_NO_DROP, FLAG_STARTEQUIP, FOOD, free_object(), get_object(), GT_ENVIRONMENT, insert_ob_in_map(), llevError, LOG(), polymorph_melt(), QUERY_FLAG, remove_ob(), RING, and rndm().

Referenced by polymorph().

Here is the call graph for this function:

Here is the caller graph for this function:

static void polymorph_living ( object *  op,
int  level 
) [static]

Takes a living object (op) and turns it into another monster of some sort.

Parameters:
opobject to try to polymorph. Should be monster.
levellevel of the polymorph spell.

Definition at line 173 of file spell_effect.c.

References add_friendly_object(), ATNR_MAGIC, CLEAR_FLAG, copy_object(), create_treasure(), did_make_save(), mapdef::difficulty, find_free_spot(), first_archetype, FLAG_APPLIED, FLAG_FRIENDLY, FLAG_MONSTER, free_object(), get_owner(), GT_INVISIBLE, HAS_RANDOM_ITEMS, insert_ob_in_map(), manual_apply(), monster_check_apply(), PETMOVE, QUERY_FLAG, remove_friendly_object(), remove_ob(), rndm(), SET_FLAG, set_owner(), SIZEOFFREE, and SPELL.

Referenced by polymorph().

Here is the call graph for this function:

Here is the caller graph for this function:

static void polymorph_melt ( object *  who,
object *  op 
) [static]

Destroys item from polymorph failure.

Note:
We should probably do something more clever ala nethack - create an iron golem or something.
Parameters:
whowho cast the spell.
opspell victim.

Definition at line 272 of file spell_effect.c.

References draw_ext_info_format(), free_object(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_GREY, play_sound_map(), query_name(), remove_ob(), and SOUND_TYPE_ITEM.

Referenced by polymorph(), and polymorph_item().

Here is the call graph for this function:

Here is the caller graph for this function:

int probe ( object *  op,
object *  caster,
object *  spell_ob,
int  dir 
)

Try to get information about a living thing.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obspell object being cast.
dircast direction.
Return values:
0nothing probed.
1something was probed.

Definition at line 715 of file spell_effect.c.

References draw_ext_info(), examine_monster(), FLAG_ALIVE, FLAG_MONSTER, FLAG_WIZCAST, freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, P_IS_ALIVE, P_NO_MAGIC, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, and SP_level_range_adjust().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int recharge ( object *  op,
object *  caster,
object *  spell_ob 
)

Recharge wands.

Parameters:
opwho is casting.
casterwhat is casting.
spell_obspell object.
Return values:
0nothing happened.
1wand was recharged, or destroyed.

Definition at line 90 of file spell_effect.c.

References create_archetype(), draw_ext_info(), draw_ext_info_format(), find_marked_object(), FLAG_ANIMATE, free_object(), insert_ob_in_map(), MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, play_sound_map(), PREFER_HIGH, QUERY_FLAG, query_name(), random_roll(), remove_ob(), SET_FLAG, SOUND_TYPE_ITEM, SP_level_dam_adjust(), update_ob_speed(), and WAND.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int remove_curse ( object *  op,
object *  caster,
object *  spell 
)

This function removes the cursed/damned status on equipped items.

Parameters:
opwho is casting.
casterwhat is casting.
spellactual spell object.
Returns:
how many items were affected.
Todo:
why is the value set to 0?

Definition at line 2317 of file spell_effect.c.

References caster_level(), CLEAR_FLAG, draw_ext_info(), esrv_update_item(), FLAG_APPLIED, FLAG_CURSED, FLAG_DAMNED, FLAG_KNOWN_CURSED, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, PLAYER, QUERY_FLAG, and UPD_FLAGS.

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:

int write_mark ( object *  op,
object *  spell,
const char *  msg 
)

This writes a rune that contains the appropriate message.

There really isn't any adjustments we make.

Parameters:
opwho is casting.
spellactual spell cast.
msgmessage to write.
Return values:
0failure.
1success.

Definition at line 3257 of file spell_effect.c.

References add_string(), arch_to_object(), draw_ext_info(), HUGE_BUF, insert_ob_in_map(), llevInfo, LOG(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, NDI_UNIQUE, and strcasestr_local().

Referenced by cast_spell().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

object * large [static]

Nugget items.

Definition at line 2091 of file spell_effect.c.

Referenced by alchemy(), do_tiled_map_picture(), and place_alchemy_objects().

uint64 large_value [static]

Value of nuggets.

Definition at line 2093 of file spell_effect.c.

Referenced by alchemy(), and alchemy_object().

const char* const no_gain_msgs[NUM_STATS] [static]
Initial value:
 {
    "You grow no stronger.",
    "You grow no more agile.",
    "You don't feel any healthier.",
    "no wis",
    "You are no easier to look at.",
    "no int",
    "no pow"
}

This is used for the spells that gain stats.

There are no spells right now that icnrease wis/int/pow on a temp basis, so no good comments for those.

Definition at line 1796 of file spell_effect.c.

Referenced by cast_change_ability().

object* small [static]
uint64 small_value [static]

Definition at line 2093 of file spell_effect.c.

Referenced by alchemy(), and alchemy_object().