Crossfire Server, Trunk
rune.cpp File Reference
#include "global.h"
#include <string.h>
#include "sproto.h"
#include "spells.h"
+ Include dependency graph for rune.cpp:

Go to the source code of this file.

Macros

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

Functions

int dispel_rune (object *op, object *skill, int dir)
 
static void rune_attack (object *op, object *victim)
 
void spring_trap (object *trap, object *victim)
 
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.cpp.

Macro Definition Documentation

◆ sqr

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

Definition at line 28 of file rune.cpp.

Function Documentation

◆ dispel_rune()

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

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

Parameters
opobject trying to disarm.
skillskill to disarm runes.
dirdirection to disarm.
Return values
0rune wasn't disarmed.
1a rune was disarmed.

Definition at line 304 of file rune.cpp.

References draw_ext_info(), FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), m, MSG_TYPE_SPELL, MSG_TYPE_SPELL_FAILURE, MSG_TYPE_SPELL_SUCCESS, NDI_UNIQUE, object_find_by_type2(), object_free_drop_inventory(), object_remove(), give::op, P_OUT_OF_MAP, RUNE, SIGN, Ice::tmp, TRAP, trap_disarm(), diamondslots::x, and diamondslots::y.

Referenced by cast_spell().

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

◆ rune_attack()

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 184 of file rune.cpp.

References create_treasure(), DISEASE, HAS_RANDOM_ITEMS, hit_map(), hit_player(), infect_object(), object_free_drop_inventory(), object_remove(), object_was_destroyed, give::op, CFweardisguise::tag, and sword_of_souls::victim.

Referenced by spring_trap().

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

◆ spring_trap()

void spring_trap ( object trap,
object victim 
)

◆ trap_disarm()

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 442 of file rune.cpp.

References living::dam, destroy_object(), living::Dex, mapstruct::difficulty, draw_ext_info(), draw_ext_info_format(), object::inv, object::level, object::map, MAX, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_FAILURE, MSG_TYPE_COMMAND_SUCCESS, object::name, NDI_UNIQUE, object_get_owner(), PLAYER, PREFER_LOW, random_roll(), spring_trap(), sqr, object::stats, and object::type.

Referenced by dispel_rune(), and remove_trap().

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

◆ trap_see()

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 385 of file rune.cpp.

References living::Cha, draw_ext_info_format(), object::level, MAX, MIN, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_SUCCESS, object::name, NDI_UNIQUE, give::op, PREFER_HIGH, random_roll(), and object::stats.

Referenced by find_traps().

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

◆ trap_show()

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 412 of file rune.cpp.

References object::animation, create_archetype(), object::face, GET_ANIMATION, object_insert_in_map_at(), object::temp_animation, and python_pickup::where.

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:

◆ write_rune()

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 50 of file rune.cpp.

References object::animation, arch_to_object(), buf, caster_level(), living::Cha, create_archetype(), object::direction, draw_ext_info(), draw_ext_info_format(), object::face, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, GENERIC_RUNE, get_map_flags(), object::level, m, MAX_BUF, MSG_TYPE_SPELL, MSG_TYPE_SPELL_ERROR, object::name, NDI_UNIQUE, object_copy(), object_insert_in_map_at(), object_insert_in_ob(), object_matches_string(), object_new(), object_set_msg(), object_set_owner(), give::op, object::other_arch, object::path_attuned, object::path_denied, RUNE, set_spell_skill(), object::skill, SP_level_spellpoint_cost(), SPELL, SPELL_GRACE, SPELL_MANA, object::stats, Ice::tmp, try_find_animation(), try_find_face(), and object::type.

Referenced by cast_spell().

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