Crossfire Server, Branches 1.12  R18729
rune.c File Reference
#include <global.h>
#include <sproto.h>
#include <spells.h>
+ Include dependency graph for rune.c:

Go to the source code of this file.

Macros

#define sqr(x)   ((x)*(x))
 

Functions

int dispel_rune (object *op, object *caster, object *spell, object *skill, int dir)
 
static void rune_attack (object *op, object *victim)
 
void spring_trap (object *trap, object *victim)
 
void trap_adjust (object *trap, int difficulty)
 
int trap_disarm (object *disarmer, object *trap, int risk, object *skill)
 
int trap_see (object *op, object *trap)
 
int trap_show (object *trap, object *where)
 
int write_rune (object *op, object *caster, object *spell, int dir, const char *runename)
 

Detailed Description

All rune-related functions.

Definition in file rune.c.

Macro Definition Documentation

#define sqr (   x)    ((x)*(x))

Definition at line 43 of file rune.c.

Referenced by trap_disarm().

Function Documentation

int dispel_rune ( object op,
object caster,
object spell,
object skill,
int  dir 
)

Someone is trying to disarm a rune. The actual attempt is done in trap_disarm().

Parameters
opobject trying to disarm.
casterobject casting the disarm spell.
spellactual spell for casting.
skillskill to disarm runes.
dirdirection to disarm.
Return values
0rune wasn't disarmed.
1a rune was disarmed.

Definition at line 323 of file rune.c.

References obj::above, obj::arch, obj::below, draw_ext_info(), free_object(), freearr_x, freearr_y, get_map_flags(), GET_MAP_OB, obj::inv, obj::map, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, archt::name, NDI_UNIQUE, P_OUT_OF_MAP, remove_ob(), RUNE, SIGN, TRAP, trap_disarm(), obj::type, obj::x, and obj::y.

Referenced by cast_spell().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void rune_attack ( object op,
object victim 
)
static

This function handles those runes which detonate but do not cast spells. Typically, poisoned or diseased runes.

Parameters
oprune.
victimvictim of the rune.

Definition at line 197 of file rune.c.

References obj::attacktype, obj::count, create_treasure(), liv::dam, mapdef::difficulty, DISEASE, free_object(), HAS_RANDOM_ITEMS, hit_map(), hit_player(), infect_object(), obj::inv, obj::map, obj::randomitems, remove_ob(), obj::stats, obj::type, and was_destroyed.

Referenced by spring_trap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void spring_trap ( object trap,
object victim 
)

This function generalizes attacks by runes/traps. This ought to make it possible for runes to attack from the inventory, it'll spring the trap on the victim.

Parameters
traptrap that activates.
victimvictim of the trap.

Definition at line 227 of file rune.c.

References arch_to_object(), cast_spell(), archt::clone, obj::count, obj::direction, rv_vector::distance, draw_ext_info(), FLAG_ALIVE, FLAG_IS_LINKED, FLAG_IS_USED_UP, liv::food, free_object(), get_rangevector(), liv::hp, insert_ob_in_map(), obj::inv, obj::map, MAX, liv::maxhp, obj::msg, MSG_TYPE_APPLY, MSG_TYPE_APPLY_TRAP, NDI_UNIQUE, object_get_env_recursive(), obj::other_arch, PLAYER, QUERY_FLAG, remove_ob(), rune_attack(), SET_FLAG, SIGN, SPELL, obj::stats, trap_show(), obj::type, use_trigger(), was_destroyed, obj::x, and obj::y.

Referenced by attempt_pick_lock(), cfapi_object_spring_trap(), common_trap_type_move_on(), hit_player(), player_attack_door(), save_throw_object(), trap_disarm(), and treasure_type_apply().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void trap_adjust ( object trap,
int  difficulty 
)

Adjust trap difficulty to the map. The default traps are too strong for wimpy level 1 players, and unthreatening to anyone of high level

Parameters
traptrap to adjust.
difficultymap difficulty.

Definition at line 508 of file rune.c.

References AT_DEATH, AT_POISON, obj::attacktype, liv::Cha, liv::dam, obj::inv, obj::level, obj::other_arch, rndm(), and obj::stats.

+ Here is the call graph for this function:

int trap_disarm ( object disarmer,
object trap,
int  risk,
object skill 
)

Try to disarm a trap/rune.

Parameters
disarmerobject disarming the trap/rune.
traptrap to disarm.
riskif 0, trap/rune won't spring if disarm failure. Else it will spring.
skillspell used to disarm.
Returns
experience to award, 0 for failure.

Definition at line 459 of file rune.c.

References liv::dam, destroy_object(), liv::Dex, mapdef::difficulty, draw_ext_info(), draw_ext_info_format(), obj::inv, obj::level, obj::map, MAX, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, obj::owner, PLAYER, PREFER_LOW, random_roll(), spring_trap(), sqr, obj::stats, and obj::type.

Referenced by dispel_rune(), and remove_trap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int trap_see ( object op,
object trap 
)

Should op see trap?

Parameters
opliving that could spot the trap.
traptrap that is invisible.
Return values
0trap wasn't spotted.
1trap was spotted.

Definition at line 403 of file rune.c.

References liv::Cha, mapdef::difficulty, draw_ext_info_format(), obj::level, obj::map, MAX, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, obj::name, NDI_UNIQUE, PREFER_HIGH, random_roll(), and obj::stats.

Referenced by find_traps().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int trap_show ( object trap,
object where 
)

Handles showing a trap/rune detonation.

Parameters
traptrap that detonates.
whereobject at the location to detonate.
Return values
0no animation inserted.
1animation inserted.

Definition at line 431 of file rune.c.

References create_archetype(), obj::face, GET_ANIMATION, insert_ob_in_map(), obj::map, new_faces, obj::x, and obj::y.

Referenced by find_traps(), remove_trap(), and spring_trap().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int write_rune ( object op,
object caster,
object spell,
int  dir,
const char *  runename 
)

Player is attempting to write a magical rune. This function does all checks for paths, sp/gr, ...

Parameters
oprune writer.
casterobject used for casting this rune.
spellwriting spell.
dirorientation of rune, direction rune's contained spell will be cast in, if applicable
runenamename of the rune or message displayed by the rune for a rune of marking.
Return values
0no rune was written.
1rune written.

Definition at line 66 of file rune.c.

References obj::above, add_string(), arch_to_object(), obj::below, blank_face, caster_level(), liv::Cha, copy_object(), create_archetype(), obj::direction, draw_ext_info(), draw_ext_info_format(), obj::face, freearr_x, freearr_y, GENERIC_RUNE, get_map_flags(), GET_MAP_OB, get_object(), liv::grace, insert_ob_in_map(), insert_ob_in_ob(), obj::inv, item_matched_string(), obj::level, obj::map, MAX_BUF, obj::msg, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, obj::name, NDI_UNIQUE, obj::other_arch, obj::path_attuned, obj::path_denied, RUNE, set_owner(), set_spell_skill(), obj::skill, snprintf(), liv::sp, SP_level_spellpoint_cost(), SPELL, SPELL_GRACE, SPELL_MANA, obj::stats, obj::type, obj::x, and obj::y.

Referenced by cast_spell().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: