Crossfire Server, Branches 1.12
R18729
|
#include <global.h>
#include <spells.h>
#include <object.h>
#include <errno.h>
#include <sproto.h>
#include <sounds.h>
#include <assert.h>
Go to the source code of this file.
Functions | |
static int | can_be_transmuted (object *op) |
int | cast_create_obj (object *op, object *new_op, int dir) |
int | cast_spell (object *op, object *caster, int dir, object *spell_ob, char *stringarg) |
int | caster_level (const object *caster, const object *spell) |
void | check_spell_expiry (object *spell) |
object * | check_spell_known (object *op, const char *name) |
void | check_spells (void) |
void | drain_rod_charge (object *rod) |
void | drain_wand_charge (object *wand) |
void | dump_spells (void) |
object * | find_random_spell_in_ob (object *ob, const char *skill) |
object * | find_target_for_friendly_spell (object *op, int dir) |
int | fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) |
static void | handle_spell_confusion (object *op) |
object * | lookup_spell_by_name (object *op, const char *spname) |
int | min_casting_level (const object *caster, const object *spell) |
int | ok_to_put_more (mapstruct *m, sint16 x, sint16 y, object *op, uint32 immune_stop) |
static void | prayer_failure (object *op, int failure, int power) |
static int | put_a_monster (object *op, const char *monstername) |
int | reflwall (mapstruct *m, int x, int y, object *sp_op) |
void | regenerate_rod (object *rod) |
void | set_spell_skill (object *op, object *caster, object *spob, object *dest) |
void | shuffle_attack (object *op, int change_face) |
int | SP_level_dam_adjust (const object *caster, const object *spob) |
int | SP_level_duration_adjust (const object *caster, const object *spob) |
int | SP_level_range_adjust (const object *caster, const object *spob) |
sint16 | SP_level_spellpoint_cost (object *caster, object *spell, int flags) |
void | spell_effect (object *spob, int x, int y, mapstruct *map, object *originator) |
void | spell_failure (object *op, int failure, int power, object *skill) |
int | spell_find_dir (mapstruct *m, int x, int y, object *exclude) |
void | store_spell_expiry (object *spell) |
int | summon_hostile_monsters (object *op, int n, const char *monstername) |
static void | swap_random_stats (object *op) |
static void | transmute_item_to_flower (object *op) |
Variables | |
const char *const | spell_mapping [] |
Spell-related helper functions.
Definition in file spell_util.c.
|
static |
Determines if an item can be transmuted after a cast failure.
op | item to check. |
Definition at line 1134 of file spell_util.c.
References obj::invisible, POTION, ROD, SCROLL, obj::type, WAND, and WEAPON.
Referenced by transmute_item_to_flower().
Creates object new_op in direction dir or if that is blocked, beneath the player (op). we pass 'caster', but don't use it for anything. This is really just a simple wrapper function .
op | who is casting. |
new_op | object to insert. |
dir | direction to insert into. Can be 0. |
Definition at line 517 of file spell_util.c.
References draw_ext_info(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, INS_BELOW_ORIGINATOR, insert_ob_in_map(), obj::map, MSG_TYPE_SPELL, MSG_TYPE_SPELL_INFO, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, P_OUT_OF_MAP, obj::x, and obj::y.
Referenced by cast_create_food(), cast_create_missile(), and cast_create_town_portal().
Main dispatch when someone casts a spell.
Will decrease mana/gr points, check for skill, confusion and such.
Note that this function is really a dispatch routine that calls other functions - it just blindly returns what ever value those functions return. So if your writing a new function that is called from this, it should also return 1 on success, 0 on failure.
if it is a player casting the spell (op->type == PLAYER, op == caster), this function will decrease the mana/grace appropriately. For other objects, the caller should do what it considers appropriate.
op | creature that is owner of the object that is casting the spell - eg, the player or monster. |
caster | actual object (wand, potion) casting the spell. can be same as op. |
dir | direction to cast in. Note in some cases, if the spell is self only, dir really doesn't make a difference. |
spell_ob | spell object that is being cast. From that, we can determine what to do. * |
stringarg | any options that are being used. It can be NULL. Almost certainly, only players will set it. It is basically used as optional parameters to a spell (eg, item to create, information for marking runes, etc. |
Definition at line 1308 of file spell_util.c.
References alchemy(), obj::anim_suffix, animate_weapon(), apply_anim_suffix(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_change_map_lightlevel(), cast_cone(), cast_consecrate(), cast_create_food(), cast_create_missile(), cast_create_town_portal(), cast_curse(), cast_destruction(), cast_detection(), cast_earth_to_dust(), cast_heal(), cast_identify(), cast_invisible(), cast_item_curse_or_curse(), cast_light(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), cast_transfer(), cast_wonder(), cast_word_of_recall(), caster_level(), obj::casting_time, Settings::casting_time, change_skill(), cleric_chance, obj::contr, create_aura(), create_bomb(), determine_god(), dimension_door(), dispel_rune(), draw_ext_info(), draw_ext_info_format(), draw_magic_map(), pl::encumbrance, FABS, find_random_spell_in_ob(), find_skill_by_name(), fire_arch_from_position(), fire_bolt(), fire_bullet(), fire_swarm(), FIREWALL, FLAG_ALIVE, FLAG_CONFUSED, FLAG_MONSTER, FLAG_WIZ, FLAG_WIZCAST, freearr_x, freearr_y, get_map_flags(), get_owner(), liv::grace, handle_spell_confusion(), HORN, obj::level, llevError, LOG(), magic_wall(), obj::map, MAX, MAX_BUF, liv::maxgrace, min_casting_level(), mood_change(), MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_MISSING, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_INFO, obj::name, NDI_UNIQUE, P_NO_CLERIC, P_NO_MAGIC, obj::path_attuned, obj::path_denied, obj::path_repelled, PATH_TIME_MULT, perceive_self(), play_sound_map(), play_sound_player_only(), PLAYER, POTION, prayer_failure(), PREFER_HIGH, PREFER_LOW, probe(), QUERY_FLAG, query_name(), random_roll(), range_golem, range_magic, range_misc, recharge(), remove_curse(), rndm(), ROD, RUNE, SCROLL, settings, pl::shoottype, obj::skill, SOUND_TYPE_SPELL, liv::sp, SP_ALCHEMY, SP_ANIMATE_WEAPON, SP_AURA, SP_BLESS, SP_BOLT, SP_BOMB, SP_BULLET, SP_CAUSE_DISEASE, SP_CHANGE_ABILITY, SP_CHANGE_MANA, SP_CHANGE_MAP_LIGHT, SP_CHARGING, SP_CONE, SP_CONSECRATE, SP_CREATE_FOOD, SP_CREATE_MISSILE, SP_CURSE, SP_DESTRUCTION, SP_DETECTION, SP_DIMENSION_DOOR, SP_DISPEL_RUNE, SP_EARTH_TO_DUST, SP_FAERY_FIRE, SP_HEALING, SP_IDENTIFY, SP_INVISIBLE, SP_ITEM_CURSE_BLESS, SP_level_spellpoint_cost(), SP_LIGHT, SP_MAGIC_MAPPING, SP_MAGIC_MISSILE, SP_MAGIC_WALL, SP_MAKE_MARK, SP_MOOD_CHANGE, SP_MOVING_BALL, SP_PERCEIVE_SELF, SP_POLYMORPH, SP_PROBE, SP_RAISE_DEAD, SP_REMOVE_CURSE, SP_RUNE, SP_SMITE, SP_SUMMON_GOLEM, SP_SUMMON_MONSTER, SP_SWARM, SP_TOWN_PORTAL, SP_WONDER, SP_WORD_OF_RECALL, obj::speed, obj::speed_left, SPELL, obj::spell, spell_effect(), spell_failure(), Settings::spell_failure_effects, SPELL_GRACE, SPELL_MANA, obj::spellarg, obj::stats, strdup_local(), obj::subtype, summon_golem(), summon_object(), TRUE, obj::type, WAND, liv::Wis, write_mark(), write_rune(), obj::x, and obj::y.
Referenced by altar_type_move_on(), cast_dust(), cast_wonder(), cfapi_object_cast(), command_cast_spell(), fire(), fire_misc_object(), monster_cast_spell(), monster_use_range(), move_firewall(), potion_type_apply(), scroll_type_apply(), spring_trap(), and START_TEST().
This function returns the effective level the spell is being cast at. Note that I changed the repelled/attuned bonus to 2 from 5. This is because the new code compares casting_level against min_caster_level, so the difference is effectively 4
caster | person casting the spell. |
spell | spell object. |
Definition at line 237 of file spell_util.c.
References obj::contr, pl::last_skill_ob, obj::level, NUM_SKILLS, obj::path_attuned, obj::path_repelled, PLAYER, obj::skill, and obj::type.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_consecrate(), cast_create_town_portal(), cast_detection(), cast_polymorph(), cast_raise_dead_spell(), cast_smite_spell(), cast_spell(), cast_transfer(), create_aura(), fire_arch_from_position(), fire_swarm(), magic_wall(), mood_change(), remove_curse(), SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), SP_level_spellpoint_cost(), summon_golem(), summon_object(), and write_rune().
void check_spell_expiry | ( | object * | spell | ) |
Checks if player should be warned of soon expiring spell.
Should be called at each move of the spell. Will use key stored by store_spell_expiry(). If the spell effect/force isn't in a player's inventory, won't do anything.
spell | force or spell whose effects will expire. |
Definition at line 1854 of file spell_util.c.
References draw_ext_info_format(), obj::duration, obj::env, get_ob_key_value(), MSG_TYPE_SPELL, MSG_TYPE_SPELL_INFO, obj::name, NDI_NAVY, NDI_UNIQUE, PLAYER, and obj::type.
Referenced by move_aura(), and remove_force().
Checks to see if player knows the spell. If the name is the same as an existing spell, we presume they know it.
op | object we're looking into. |
name | spell name. Doesn't need to be a shared string. |
Definition at line 408 of file spell_util.c.
References obj::below, obj::inv, obj::name, SPELL, and obj::type.
Referenced by cfapi_object_check_spell(), command_learn_spell_or_prayer(), do_forget_spell(), do_learn_spell(), dragon_ability_gain(), god_intervention(), and spellbook_type_apply().
void check_spells | ( | void | ) |
It goes through the spells looking for any obvious errors. This was most useful in debugging when re-doing all the spells to catch simple errors. To use it all the time will result in it spitting out messages that aren't really errors.
Definition at line 120 of file spell_util.c.
References archt::clone, find_archetype(), first_archetype, llevDebug, llevError, LOG(), archt::name, archt::next, NUM_SKILLS, obj::skill, skill_names, SPELL, spell_mapping, and obj::type.
Referenced by init_beforeplay().
void drain_rod_charge | ( | object * | rod | ) |
Drain charges from a rod.
rod | rod to drain. |
Definition at line 743 of file spell_util.c.
References liv::hp, obj::inv, SP_level_spellpoint_cost(), SPELL_HIGHEST, and obj::stats.
Referenced by fire_misc_object(), and monster_use_range().
void drain_wand_charge | ( | object * | wand | ) |
Drains a charge from a wand. Handles animation fix, and player update if required.
wand | wand to drain. Must be of type WAND. |
Definition at line 753 of file spell_util.c.
References obj::arch, CLEAR_FLAG, archt::clone, esrv_update_item(), obj::face, FLAG_ANIMATE, liv::food, get_player_container(), obj::speed, obj::stats, obj::type, UPD_ANIM, update_ob_speed(), and WAND.
Referenced by fire_misc_object(), and monster_use_range().
void dump_spells | ( | void | ) |
Dumps all the spells - now also dumps skill associated with the spell. not sure what this would be used for, as the data seems pretty minimal, but easy enough to keep around.
Definition at line 157 of file spell_util.c.
References archt::clone, first_archetype, obj::level, obj::name, archt::name, archt::next, obj::other_arch, obj::skill, SPELL, and obj::type.
Referenced by init_beforeplay().
This returns a random spell from 'ob'. If skill is set, then the spell must be of this skill, it can be NULL in which case all matching spells are used.
ob | object to find spells in. |
skill | skill the spell should match, NULL if can match any spell. |
Definition at line 60 of file spell_util.c.
References obj::below, obj::inv, obj::skill, SPELL, and obj::type.
Referenced by cast_spell(), and write_scroll().
This function is commonly used to find a friendly target for spells such as heal or protection or armour
op | what is looking for the target (which can be a player). |
dir | direction we are looking in. |
Definition at line 779 of file spell_util.c.
References obj::above, obj::below, FLAG_MONSTER, freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, get_owner(), obj::inv, obj::map, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, TRANSPORT, obj::type, obj::x, and obj::y.
Referenced by cast_bless(), cast_change_ability(), and cast_heal().
int fire_arch_from_position | ( | object * | op, |
object * | caster, | ||
sint16 | x, | ||
sint16 | y, | ||
int | dir, | ||
object * | spell | ||
) |
Fires an archetype.
op | person firing the object. |
caster | object casting the spell. |
x | |
y | where to fire the spell. |
dir | direction to fire in. |
spell | spell that is being fired. It uses other_arch for the archetype to fire. |
Definition at line 653 of file spell_util.c.
References arch_to_object(), AT_GODPOWER, AT_HOLYWORD, obj::attacktype, caster_level(), copy_owner(), liv::dam, obj::direction, draw_ext_info(), obj::duration, FLAG_IS_TURNABLE, liv::food, free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, get_owner(), insert_ob_in_map(), obj::level, obj::map, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, NDI_UNIQUE, ob_process(), OB_TYPE_MOVE_BLOCK, obj::other_arch, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, obj::range, SET_ANIMATION, set_owner(), set_spell_skill(), SP_level_dam_adjust(), SP_level_duration_adjust(), SP_level_range_adjust(), obj::stats, tailor_god_spell(), obj::type, obj::x, and obj::y.
Referenced by alchemy_failure_effect(), cast_spell(), and move_swarm_spell().
|
static |
This does a random effect for op, which tried to cast a spell in a confused state.
Note that random spell casting is handled in cast_spell itself.
Used for spell casting when confused.
op | player for which to produce a random effect. |
Definition at line 1261 of file spell_util.c.
References swap_random_stats(), and transmute_item_to_flower().
Referenced by cast_spell().
Look at object 'op' and see if they know the spell spname. This is pretty close to check_spell_known above, but it uses a looser matching mechanism.
op | object we're searching the inventory. |
spname | partial spell name. |
Definition at line 430 of file spell_util.c.
References obj::below, obj::inv, llevError, LOG(), and SPELL.
Referenced by command_cast_spell(), and command_forget_spell().
This function takes a caster and spell and presents the effective level the caster needs to be to cast the spell. Basically, it just adjusts the spell->level with attuned/repelled spellpaths.
caster | person casting the spell. |
spell | spell object. |
Definition at line 207 of file spell_util.c.
References obj::level, MAX, obj::path_attuned, obj::path_denied, and obj::path_repelled.
Referenced by cast_spell(), SP_level_dam_adjust(), SP_level_duration_adjust(), and SP_level_range_adjust().
Returns true if it is ok to put spell op on the space/may provided.
m | |
x | |
y | coordinates to test. |
op | spell to test for. |
immune_stop | basically the attacktype of the spell (why passed as a different value, not sure of). If immune_stop has the AT_MAGIC bit set, and there is a counterwall on the space, the object doesn't get placed. if immune_stop does not have AT_MAGIC, then counterwalls do not effect the spell. |
Definition at line 555 of file spell_util.c.
References obj::above, ARROW, AT_COUNTERSPELL, AT_MAGIC, obj::attacktype, BOW, FLAG_MONSTER, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, GOLEM, liv::maxhp, OB_SPELL_TAG_MATCH, OB_TYPE_MOVE_BLOCK, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, Statistics::spell_suppressions, SPELL_TAG_SIZE, obj::spell_tags, statistics, obj::stats, obj::subtype, obj::type, and WEAPON.
Referenced by explosion(), and move_cone().
|
static |
Called when a player fails at casting a prayer.
op | player. |
failure | basically how much grace they had. |
power | how much grace the spell would normally take to cast. |
Definition at line 1025 of file spell_util.c.
References cast_cone(), cast_magic_storm(), confuse_living(), create_archetype(), determine_god(), draw_ext_info(), draw_ext_info_format(), free_object(), GOD_POWER, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, paralyze_living(), and SPELL_WONDER.
Referenced by cast_spell().
|
static |
Puts a monster named monstername near by op. This creates the treasures for the monsters, and also deals with multipart monsters properly.
op | victim. |
monstername | monster's archetype name. |
Definition at line 901 of file spell_util.c.
References arch_to_object(), archt::clone, create_archetype(), create_treasure(), mapdef::difficulty, find_archetype(), find_first_free_spot(), freearr_x, freearr_y, GT_INVISIBLE, obj::head, insert_ob_in_map(), obj::map, obj::more, archt::more, obj::randomitems, obj::x, and obj::y.
Referenced by summon_hostile_monsters().
Decides weither the (spell-)object sp_op will be reflected from the given mapsquare. Returns 1 if true.
(Note that for living creatures there is a small chance that reflect_spell fails.)
Caller should be sure it passes us valid map coordinates eg, updated for tiled maps.
m | |
x | |
y | position of the object to test. |
sp_op | spell object to test. |
Definition at line 490 of file spell_util.c.
References obj::above, FLAG_ALIVE, FLAG_REFL_SPELL, GET_MAP_OB, obj::level, OUT_OF_REAL_MAP, QUERY_FLAG, and rndm().
Referenced by move_bolt(), and move_bullet().
void regenerate_rod | ( | object * | rod | ) |
Regenerates a rod's charges.
rod | rod to regenerate. |
Definition at line 728 of file spell_util.c.
References liv::hp, liv::maxhp, and obj::stats.
Referenced by legacy_ob_process().
Utility function to assign the correct skill when casting.
Relatively simple function that gets used a lot. Basically, it sets up the skill pointer for the spell being cast. If op is really casting the spell, then the skill is whatever skill the spell requires. if instead caster (rod, horn, wand, etc) is casting the skill, then they get exp for the skill that you need to use for that object (use magic device).
op | object casting the spell. |
caster | object used to cast the spell (rod, wand, ...). |
spob | spell object. |
dest | object to set the skill for. |
Definition at line 105 of file spell_util.c.
References add_refcount(), FREE_AND_CLEAR_STR, and obj::skill.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_smite_spell(), create_aura(), create_bomb(), fire_arch_from_position(), fire_bolt(), fire_bullet(), fire_swarm(), magic_wall(), mood_change(), summon_golem(), summon_object(), and write_rune().
void shuffle_attack | ( | object * | op, |
int | change_face | ||
) |
This routine shuffles the attack of op to one of the ones in the list. It does this at random. It also chooses a face appropriate to the attack that is being committed by that square at the moment.
right now it's being used by color spray and create pool of chaos.
This could really be a better implementation - the faces and attacktypes above are hardcoded, which is never good. The faces refer to faces in the animation sequence. Not sure how to do better - but not having it hardcoded would be nice.
I also fixed a bug here in that attacktype was |= - to me, that would be that it would quickly get all attacktypes, which probably wasn't the intent. MSW 2003-06-03
op | object to change. |
change_face | if set, also changes the face, else only changes the attacktype. |
Definition at line 1004 of file spell_util.c.
References AT_MAGIC, ATTACKS, Chaos_Attacks::attacktype, obj::attacktype, rndm(), and SET_ANIMATION.
Referenced by hit_map().
Returns adjusted damage based on the caster.
caster | who is casting. |
spob | spell we are adjusting. |
Definition at line 332 of file spell_util.c.
References caster_level(), obj::dam_modifier, and min_casting_level().
Referenced by alchemy(), animate_weapon(), append_spell(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_create_missile(), cast_destruction(), cast_identify(), cast_light(), cast_smite_spell(), cast_transfer(), create_aura(), create_bomb(), esrv_update_spells(), fire_arch_from_position(), fire_bolt(), fire_bullet(), magic_wall(), recharge(), summon_golem(), and summon_object().
Adjust the duration of the spell based on level. This is basically the same as SP_level_dam_adjust() above, but instead looks at the level_modifier value.
caster | who is casting. |
spob | spell we are adjusting. |
Definition at line 357 of file spell_util.c.
References caster_level(), obj::duration_modifier, and min_casting_level().
Referenced by alchemy(), animate_weapon(), cast_bless(), cast_cause_disease(), cast_change_ability(), cast_cone(), cast_create_food(), cast_create_missile(), cast_curse(), cast_destruction(), cast_invisible(), cast_light(), cast_word_of_recall(), create_aura(), create_bomb(), fire_arch_from_position(), fire_bolt(), fire_bullet(), fire_swarm(), magic_wall(), and summon_golem().
Adjust the range of the spell based on level. This is basically the same as SP_level_dam_adjust() above, but instead looks at the level_modifier value.
caster | who is casting. |
spob | spell we are adjusting. |
Definition at line 383 of file spell_util.c.
References caster_level(), min_casting_level(), and obj::range_modifier.
Referenced by animate_weapon(), cast_cause_disease(), cast_cone(), cast_destruction(), cast_detection(), cast_earth_to_dust(), cast_light(), cast_polymorph(), cast_smite_spell(), create_bomb(), dimension_door(), fire_arch_from_position(), fire_bolt(), fire_bullet(), magic_wall(), mood_change(), probe(), and summon_golem().
Scales the spellpoint cost of a spell by it's increased effectiveness. Some of the lower level spells become incredibly vicious at high levels. Very cheap mass destruction. This function is intended to keep the sp cost related to the effectiveness.
Note that it is now possible for a spell to cost both grace and mana. In that case, we return which ever value is higher.
caster | what is casting the spell. |
spell | spell object. |
flags | one of Spell/grace points. |
Definition at line 281 of file spell_util.c.
References caster_level(), liv::grace, obj::level, llevError, LOG(), MAX, liv::maxgrace, liv::maxsp, PATH_SP_MULT, settings, liv::sp, SPELL_GRACE, SPELL_HIGHEST, SPELL_MANA, Settings::spellpoint_level_depend, obj::stats, and TRUE.
Referenced by append_spell(), cast_spell(), drain_rod_charge(), esrv_update_spells(), fire_misc_object(), monster_cast_spell(), show_matching_spells(), write_rune(), and write_scroll().
Inserts into map a spell effect based on other_arch.
spob | spell object to insert object from. |
x | |
y | |
map | coordinates to put the effect at. |
originator | what causes the effect to be inserted. Can be NULL. |
Definition at line 182 of file spell_util.c.
References arch_to_object(), insert_ob_in_map(), obj::other_arch, obj::x, and obj::y.
Referenced by cast_identify(), and cast_spell().
Handles the various effects for differing degrees of failure badness.
op | player that failed. |
failure | random value of how badly you failed. |
power | how many spellpoints you'd normally need for the spell. |
skill | skill needed to cast the spell. |
Definition at line 1078 of file spell_util.c.
References AT_INTERNAL, cast_cone(), confuse_living(), obj::count, create_archetype(), liv::dam, draw_ext_info(), FALSE, free_object(), get_map_flags(), hit_player(), insert_ob_in_map(), isqrt(), obj::level, LOOSE_MANA, obj::map, liv::maxhp, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, P_NO_MAGIC, paralyze_living(), obj::range, settings, Settings::spell_failure_effects, SPELL_WONDER, obj::stats, obj::x, and obj::y.
Referenced by cast_spell().
Search what direction a spell should go in, first the center square then some close squares in the given map at the given coordinates for live objects.
It will not consider the object given as exclude (= caster) among possible live objects. If the caster is a player, the spell will go after monsters/generators only. If not, the spell will hunt players only.
Exception is player on a battleground, who will be targeted unless excluded.
m | |
x | |
y | where to search from. |
exclude | what object to avoid. Can be NULL, in which case all bets are off. |
Definition at line 852 of file spell_util.c.
References obj::above, can_see_monsterP(), FLAG_GENERATOR, FLAG_MONSTER, freearr_x, freearr_y, freedir, get_map_flags(), GET_MAP_OB, obj::head, op_on_battleground(), P_BLOCKSVIEW, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, rndm(), SIZEOFFREE, and obj::type.
Referenced by move_ball_spell(), and move_missile().
void store_spell_expiry | ( | object * | spell | ) |
Stores in the spell when to warn player of expiration.
spell | spell we're considering. |
Definition at line 1829 of file spell_util.c.
References obj::duration, set_ob_key_value(), and snprintf().
Referenced by cast_change_ability(), and create_aura().
int summon_hostile_monsters | ( | object * | op, |
int | n, | ||
const char * | monstername | ||
) |
Summons hostile monsters and places them in nearby squares.
op | the summoner. |
n | number of monsters. |
monstername | name of the monster to summon, should be a valid archetype. |
Definition at line 970 of file spell_util.c.
References put_a_monster().
Referenced by alchemy_failure_effect(), and cast_raise_dead_spell().
|
static |
Randomly swaps 2 stats of op.
Swapping is merely a FORCE inserted into op's inventory.
Used for spell casting when confused.
op | player who is the victim. |
Definition at line 1225 of file spell_util.c.
References change_abil(), create_archetype(), draw_ext_info_format(), obj::duration, fix_object(), FLAG_APPLIED, FORCE_NAME, get_attr_value(), insert_ob_in_ob(), MSG_TYPE_VICTIM, MSG_TYPE_VICTIM_SPELL, NDI_UNIQUE, NUM_STATS, rndm(), set_attr_value(), SET_FLAG, obj::speed, obj::stats, and update_ob_speed().
Referenced by handle_spell_confusion().
|
static |
This transforms one random item of op to a flower.
Only some items are considered, mostly magical ones.
Transformed item is put in a force in a flower, weights are adjusted.
See remove_force() in server/time.c to see object removal.
op | player who is the victim. |
Definition at line 1156 of file spell_util.c.
References AP_IGNORE_CURSE, AP_NOPRINT, AP_UNAPPLY, obj::below, can_be_transmuted(), obj::contr, obj::count, create_archetype(), draw_ext_info_format(), obj::duration, esrv_del_item(), esrv_send_item(), FLAG_APPLIED, FORCE_NAME, FORCE_TRANSFORMED_ITEM, HUGE_BUF, insert_ob_in_ob(), obj::inv, manual_apply(), MSG_TYPE_ITEM, MSG_TYPE_ITEM_CHANGE, NDI_UNIQUE, obj::nrof, QUERY_FLAG, query_short_name(), remove_ob(), rndm(), obj::speed, obj::subtype, update_ob_speed(), and obj::weight.
Referenced by handle_spell_confusion().
const char* const spell_mapping[] |
Referenced by check_spells().