Crossfire Server, Branches 1.12  R18729
spell_effect.c File Reference
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
+ Include dependency graph for spell_effect.c:

Go to the source code of this file.

Functions

static void animate_bomb (object *op)
 
static void check_spell_knockback (object *op)
 
static void execute_word_of_recall (object *op)
 
static void explosion (object *op)
 
static void forklightning (object *op, object *tmp)
 
void init_type_spell_effect (void)
 
static void move_aura (object *aura)
 
static void move_ball_spell (object *op)
 
static void move_bolt (object *op)
 
static void move_bullet (object *op)
 
static void move_cone (object *op)
 
static void move_missile (object *op)
 
static void move_swarm_spell (object *op)
 
static method_ret spell_effect_type_move_on (ob_methods *context, object *trap, object *victim, object *originator)
 
static method_ret spell_effect_type_process (ob_methods *context, object *op)
 

Detailed Description

The implementation of the Spell Effect class of objects.

Todo:
Split the subtype functions into their own file each, and split large functions.

Definition in file spell_effect.c.

Function Documentation

static void animate_bomb ( object op)
static

This handles an exploding bomb.

Parameters
opThe original bomb object.

Definition at line 434 of file spell_effect.c.

References add_refcount(), arch_to_object(), obj::attacktype, copy_owner(), liv::dam, obj::direction, obj::duration, obj::env, explode_bullet(), find_archetype(), FLAG_IS_TURNABLE, free_string(), freearr_x, insert_ob_in_map(), obj::map, NUM_ANIMATIONS, ob_process(), object_get_env_recursive(), out_of_map(), QUERY_FLAG, obj::range, remove_ob(), SET_ANIMATION, obj::skill, SPLINT, obj::state, obj::stats, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void check_spell_knockback ( object op)
static

Checks to see if a spell pushes objects as well as flies over and damages them (only used for cones for now) but moved here so it could be applied to bolts too

Parameters
opThe spell object.

Definition at line 869 of file spell_effect.c.

References obj::above, absdir(), FLAG_ALIVE, FLAG_IS_FLOOR, FLAG_NO_PICK, FLAG_WIZ, GET_MAP_OB, obj::head, obj::level, obj::map, obj::more, MOVE_FLYING, move_object(), obj::move_type, QUERY_FLAG, rndm(), liv::sp, obj::stats, obj::weight, obj::x, and obj::y.

Referenced by move_cone().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void execute_word_of_recall ( object op)
static

Handles the actual word of recalling. Called when force in player inventory expires.

Parameters
opThe word of recall effect activating.

Definition at line 546 of file spell_effect.c.

References draw_ext_info(), enter_exit(), obj::env, FLAG_WIZCAST, free_object(), get_map_flags(), obj::map, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, NDI_UNIQUE, P_NO_CLERIC, PLAYER, QUERY_FLAG, remove_ob(), obj::type, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void explosion ( object op)
static

Expands an explosion. op is a piece of the explosion - this expans it in the different directions. At least that is what I think this does.

Parameters
oppiece of explosion expanding.

Definition at line 317 of file spell_effect.c.

References obj::attacktype, copy_object(), obj::duration, free_object(), freearr_x, freearr_y, get_object(), hit_map(), insert_ob_in_map(), obj::map, merge_spell(), ok_to_put_more(), obj::range, remove_ob(), obj::speed_left, obj::state, obj::value, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void forklightning ( object op,
object tmp 
)
static

Causes op to fork.

Parameters
oporiginal bolt.
tmpfirst piece of the fork.

Definition at line 816 of file spell_effect.c.

References absdir(), liv::Con, copy_object(), liv::dam, liv::Dex, obj::direction, obj::duration, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, get_object(), insert_ob_in_map(), obj::map, OB_TYPE_MOVE_BLOCK, P_OUT_OF_MAP, rndm(), obj::speed_left, obj::stats, update_turn_face(), obj::x, and obj::y.

Referenced by move_bolt().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void init_type_spell_effect ( void  )

Initializer for the SPELL_EFFECT object type.

Definition at line 54 of file spell_effect.c.

References register_move_on(), register_process(), SPELL_EFFECT, spell_effect_type_move_on(), and spell_effect_type_process().

Referenced by register_all_ob_types().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_aura ( object aura)
static

Process an aura. An aura is a part of someone's inventory, which he carries with him, but which acts on the map immediately around him. Aura parameters: duration: duration counter. attacktype: aura's attacktype other_arch: archetype to drop where we attack

Parameters
auraThe spell effect.

Definition at line 748 of file spell_effect.c.

References arch_to_object(), obj::attacktype, check_spell_expiry(), obj::duration, obj::env, free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, hit_map(), insert_ob_in_map(), insert_ob_in_ob(), obj::map, OB_TYPE_MOVE_BLOCK, obj::other_arch, P_OUT_OF_MAP, remove_ob(), obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_ball_spell ( object op)
static

This handles ball type spells that just sort of wander about. Note that duration is handled by process_object() in time.c

Parameters
opThe spell effect.

Definition at line 568 of file spell_effect.c.

References absdir(), arch_to_object(), obj::attacktype, liv::dam, obj::direction, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, get_owner(), hit_map(), insert_ob_in_map(), obj::map, OB_TYPE_MOVE_BLOCK, on_same_map(), obj::other_arch, P_IS_ALIVE, P_OUT_OF_MAP, remove_ob(), rndm(), spell_find_dir(), obj::stats, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_bolt ( object op)
static

Moves bolt 'op'. Basically, it just advances a space, and checks for various things that may stop it.

Parameters
opThe bolt object moving.

Definition at line 158 of file spell_effect.c.

References absdir(), obj::attacktype, copy_object(), liv::Dex, obj::direction, DIRX, DIRY, obj::duration, FLAG_REFLECTING, forklightning(), free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, get_object(), hit_map(), insert_ob_in_map(), obj::map, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, QUERY_FLAG, obj::range, reflwall(), remove_ob(), rndm(), obj::speed_left, obj::stats, update_turn_face(), obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_bullet ( object op)
static

Moves bullet 'op'. Basically, we move 'op' one square, and if it hits something, call check_bullet. This function is only applicable to bullets, but not to all fired arches (eg, bolts).

Parameters
opThe bullet being moved.

Definition at line 261 of file spell_effect.c.

References absdir(), check_bullet(), obj::direction, DIRX, DIRY, explode_bullet(), free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, insert_ob_in_map(), obj::map, OB_TYPE_MOVE_BLOCK, obj::other_arch, P_OUT_OF_MAP, obj::range, reflwall(), remove_ob(), update_turn_face(), obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_cone ( object op)
static

Causes cone object 'op' to move a space/hit creatures.

Parameters
opcone object moving.

Definition at line 363 of file spell_effect.c.

References absdir(), obj::attacktype, check_spell_knockback(), cone_drop(), copy_object(), obj::count, obj::duration, FLAG_LIFESAVE, free_object(), freearr_x, freearr_y, get_object(), hit_map(), insert_ob_in_map(), llevError, LOG(), obj::map, liv::maxhp, obj::name, ok_to_put_more(), obj::other_arch, QUERY_FLAG, obj::range, remove_ob(), liv::sp, obj::speed, obj::stats, update_ob_speed(), was_destroyed, obj::weight, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_missile ( object op)
static

Move a missle object.

Parameters
opThe missile that needs to be moved.

Definition at line 492 of file spell_effect.c.

References AT_MAGIC, obj::count, obj::direction, DIRX, DIRY, free_object(), get_map_flags(), GET_MAP_MOVE_BLOCK, get_owner(), hit_map(), insert_ob_in_map(), obj::map, OB_TYPE_MOVE_BLOCK, P_IS_ALIVE, P_OUT_OF_MAP, obj::range, remove_ob(), SET_ANIMATION, spell_find_dir(), was_destroyed, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void move_swarm_spell ( object op)
static

Definition at line 678 of file spell_effect.c.

References absdir(), obj::direction, obj::duration, fire_arch_from_position(), fire_bullet(), free_object(), freearr_x, freearr_y, get_map_flags(), get_owner(), obj::map, P_OUT_OF_MAP, remove_ob(), rndm(), SP_BULLET, SP_MAGIC_MISSILE, SPELL, obj::spell, obj::subtype, obj::type, obj::x, and obj::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static method_ret spell_effect_type_move_on ( ob_methods context,
object trap,
object victim,
object originator 
)
static

Move on this Spell Effect object.

Parameters
contextThe method context
trapThe Spell Effect we're moving on
victimThe object moving over this one
originatorThe object that caused the move_on event
Returns
METHOD_OK

Definition at line 67 of file spell_effect.c.

References obj::attacktype, common_post_ob_move_on(), common_pre_ob_move_on(), obj::count, liv::dam, FLAG_ALIVE, free_object(), hit_player(), obj::material, obj::materialname, METHOD_ERROR, METHOD_OK, QUERY_FLAG, remove_ob(), save_throw_object(), SP_CONE, SP_MAGIC_MISSILE, SP_MOVING_BALL, obj::speed, obj::stats, obj::subtype, and was_destroyed.

Referenced by init_type_spell_effect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static method_ret spell_effect_type_process ( ob_methods context,
object op 
)
static

Handle ob_process for all SPELL_EFFECT objects.

Parameters
contextThe method context
opThe spell effect that's being processed.
Returns
METHOD_OK

Definition at line 108 of file spell_effect.c.

References animate_bomb(), execute_word_of_recall(), explosion(), METHOD_OK, move_aura(), move_ball_spell(), move_bolt(), move_bullet(), move_cone(), move_missile(), move_swarm_spell(), SP_AURA, SP_BOLT, SP_BOMB, SP_BULLET, SP_CONE, SP_EXPLOSION, SP_MAGIC_MISSILE, SP_MOVING_BALL, SP_SWARM, SP_WORD_OF_RECALL, and obj::subtype.

Referenced by init_type_spell_effect().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: