Crossfire Server, Trunk
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 (object *trap, object *victim, object *originator)
 
static method_ret spell_effect_type_process (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

◆ animate_bomb()

static void animate_bomb ( object op)
static

This handles an exploding bomb.

Parameters
opThe original bomb object.

Definition at line 454 of file spell_effect.c.

References add_refcount(), arch_to_object(), env, explode_bullet(), find_archetype(), free_string(), freearr_x, NUM_ANIMATIONS, ob_process(), object_copy_owner(), object_get_env_recursive(), object_insert_in_map_at(), object_remove(), object_update_turn_face(), give::op, out_of_map(), SPLINT, and Ice::tmp.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_spell_knockback()

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 920 of file spell_effect.c.

References absdir(), FLAG_IS_FLOOR, FLAG_NO_PICK, FLAG_WIZ, GET_MAP_OB, obj::more, MOVE_FLYING, move_object(), give::op, QUERY_FLAG, rndm(), and Ice::tmp.

Referenced by explosion(), move_bolt(), and move_cone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ execute_word_of_recall()

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 558 of file spell_effect.c.

References enter_exit(), object_free_drop_inventory(), object_remove(), give::op, PLAYER, and remove_unpaid_objects().

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ explosion()

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 313 of file spell_effect.c.

References check_spell_knockback(), freearr_x, freearr_y, hit_map(), m, object_copy(), object_free_drop_inventory(), object_insert_in_map_at(), object_merge_spell(), object_new(), object_remove(), ok_to_put_more(), give::op, and Ice::tmp.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forklightning()

static void forklightning ( object op,
object tmp 
)
static

Causes op to fork.

Parameters
oporiginal bolt.
tmpfirst piece of the fork.

Definition at line 869 of file spell_effect.c.

References absdir(), liv::Con, liv::dam, liv::Dex, obj::direction, obj::duration, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, m, OB_TYPE_MOVE_BLOCK, object_copy(), object_insert_in_map_at(), object_new(), object_update_turn_face(), give::op, P_OUT_OF_MAP, rndm(), obj::speed_left, obj::stats, and Ice::tmp.

Referenced by move_bolt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_type_spell_effect()

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:

◆ move_aura()

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 749 of file spell_effect.c.

References animate::anim, animate_object(), obj::animation, arch_to_object(), obj::attacktype, cast_spell(), check_spell_expiry(), archt::clone, obj::duration, obj::env, env, FLAG_ALIVE, FLAG_ANIMATE, FLAG_FRIENDLY, FLAG_REMOVED, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_OBJ_FREE_INVENTORY, FREE_OBJ_NO_DESTROY_CALLBACK, get_map_flags(), GET_MAP_MOVE_BLOCK, hit_map(), m, OB_TYPE_MOVE_BLOCK, object_free(), object_free_drop_inventory(), object_get_value(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), obj::other_arch, P_OUT_OF_MAP, QUERY_FLAG, obj::range, SET_FLAG, SPELL, sstring, obj::state, Ice::tmp, try_find_animation(), and obj::type.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_ball_spell()

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 580 of file spell_effect.c.

References absdir(), adjust_dir(), arch_to_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, hit_map(), m, OB_TYPE_MOVE_BLOCK, object_get_owner(), object_insert_in_map_at(), object_remove(), on_same_map(), give::op, P_IS_ALIVE, P_OUT_OF_MAP, rndm(), spell_find_dir(), 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:

◆ move_bolt()

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 156 of file spell_effect.c.

References absdir(), check_spell_knockback(), DIRX, DIRY, FLAG_REFLECTING, forklightning(), freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, hit_map(), m, OB_TYPE_MOVE_BLOCK, object_copy(), object_free_drop_inventory(), object_insert_in_map_at(), object_new(), object_remove(), object_update_turn_face(), give::op, P_IS_ALIVE, P_OUT_OF_MAP, QUERY_FLAG, reflwall(), rndm(), Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_bullet()

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 259 of file spell_effect.c.

References absdir(), check_bullet(), DIRX, DIRY, explode_bullet(), get_map_flags(), GET_MAP_MOVE_BLOCK, m, OB_TYPE_MOVE_BLOCK, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_update_turn_face(), give::op, P_OUT_OF_MAP, and reflwall().

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_cone()

static void move_cone ( object op)
static

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

Parameters
opcone object moving.

Definition at line 386 of file spell_effect.c.

References absdir(), check_spell_knockback(), cone_drop(), FLAG_LIFESAVE, freearr_x, freearr_y, hit_map(), llevError, LOG(), object_copy(), object_free_drop_inventory(), object_insert_in_map_at(), object_new(), object_remove(), object_update_speed(), object_was_destroyed, ok_to_put_more(), give::op, QUERY_FLAG, CFweardisguise::tag, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_missile()

static void move_missile ( object op)
static

Move a missle object.

Parameters
opThe missile that needs to be moved.

Definition at line 507 of file spell_effect.c.

References adjust_dir(), AT_MAGIC, DIRX, DIRY, get_map_flags(), GET_MAP_MOVE_BLOCK, hit_map(), m, OB_TYPE_MOVE_BLOCK, object_free_drop_inventory(), object_get_owner(), object_insert_in_map_at(), object_remove(), object_update_turn_face(), object_was_destroyed, give::op, P_IS_ALIVE, P_OUT_OF_MAP, spell_find_dir(), and CFweardisguise::tag.

Referenced by spell_effect_type_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_swarm_spell()

static void move_swarm_spell ( object op)
static

Definition at line 679 of file spell_effect.c.

References absdir(), fire_arch_from_position(), freearr_x, freearr_y, get_map_flags(), get_random_dir(), m, object_free_drop_inventory(), object_get_owner(), object_remove(), give::op, P_OUT_OF_MAP, rndm(), SP_BULLET, SP_MAGIC_MISSILE, SPELL, 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:

◆ spell_effect_type_move_on()

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

Move on this Spell Effect object.

Parameters
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 66 of file spell_effect.c.

References obj::attacktype, common_post_ob_move_on(), common_pre_ob_move_on(), obj::count, liv::dam, FLAG_ALIVE, hit_player(), METHOD_ERROR, METHOD_OK, object_free_drop_inventory(), object_remove(), object_was_destroyed, QUERY_FLAG, save_throw_object(), SP_CONE, SP_MAGIC_MISSILE, SP_MOVING_BALL, obj::speed, obj::stats, obj::subtype, and reputation::victim.

Referenced by init_type_spell_effect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spell_effect_type_process()

static method_ret spell_effect_type_process ( object op)
static

Handle ob_process for all SPELL_EFFECT objects.

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

Definition at line 106 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(), give::op, SP_AURA, SP_BOLT, SP_BOMB, SP_BULLET, SP_CONE, SP_EXPLOSION, SP_MAGIC_MISSILE, SP_MOVING_BALL, SP_SWARM, and SP_WORD_OF_RECALL.

Referenced by init_type_spell_effect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: