Crossfire Server, Trunk  R20513
Functions
skills.c File Reference
#include "global.h"
#include <stdlib.h>
#include <string.h>
#include "book.h"
#include "living.h"
#include "object.h"
#include "skills.h"
#include "spells.h"
#include "sproto.h"
Include dependency graph for skills.c:

Go to the source code of this file.

Functions

static int adj_stealchance (object *op, object *victim, int roll)
 Computes stealing chance. More...
 
static int attempt_hide (object *op, object *skill)
 Someone is trying to hide. More...
 
static int attempt_jump (object *pl, int dir, int spaces, object *skill)
 Someone is trying to jump. More...
 
static int attempt_pick_lock (object *door, object *pl, object *skill)
 Attempt to pick a lock. More...
 
static int attempt_steal (object *op, object *who, object *skill)
 Steal objects. More...
 
int detect_curse_on_item (object *pl, object *tmp, object *skill)
 Runs a 'detect curse' check on a given item. More...
 
int detect_magic_on_item (object *pl, object *tmp, object *skill)
 Runs a 'detect magic' check on a given item. More...
 
static int do_skill_detect_curse (object *pl, object *skill)
 Check for cursed object with the 'detect curse' skill. More...
 
static int do_skill_detect_magic (object *pl, object *skill)
 Check for magic object with the 'detect magic' skill. More...
 
static int do_skill_ident (object *pl, int obj_class, object *skill)
 Workhorse for skill_ident() -b.t. More...
 
static int do_throw (object *op, object *part, object *toss_item, int dir, object *skill)
 Op throws any object toss_item. More...
 
static objectfind_throw_ob (object *op, sstring race)
 Find an object to throw. More...
 
int find_traps (object *pl, object *skill)
 Checks for traps on the spaces around the player or in certain objects. More...
 
int hide (object *op, object *skill)
 Main hide handling. More...
 
int identify_object_with_skill (object *tmp, object *pl, object *skill, int print_on_success)
 Helper function for do_skill_ident, so that we can loop over inventory AND objects on the ground conveniently. More...
 
int jump (object *pl, int dir, object *skill)
 Jump skill handling. More...
 
static objectmake_throw_ob (object *orig)
 We construct the 'carrier' object in which we will insert the object that is being thrown. More...
 
void meditate (object *pl, object *skill)
 Meditation skill handling. More...
 
int pick_lock (object *pl, int dir, object *skill)
 Lock pick handling. More...
 
int pray (object *pl, object *skill)
 Praying skill handling. More...
 
int remove_trap (object *op, object *skill)
 This skill will disarm any previously discovered trap. More...
 
int singing (object *pl, int dir, object *skill)
 Singing skill handling. More...
 
int skill_ident (object *pl, object *skill)
 Main identification skill handling. More...
 
int skill_throw (object *op, object *part, int dir, object *skill)
 Throwing skill handling. More...
 
int steal (object *op, int dir, object *skill)
 Main stealing function. More...
 
static void stop_jump (object *pl)
 End of jump. More...
 
int use_oratory (object *pl, int dir, object *skill)
 Oratory skill handling. More...
 
static int write_note (object *pl, object *item, const char *msg)
 Called by write_on_item() to inscribe a message in an ordinary book. More...
 
int write_on_item (object *pl, const char *params, object *skill)
 Implement the 'inscription' skill, which checks for the required skills and marked items before running either write_note() or write_scroll(). More...
 
static int write_scroll (object *pl, object *scroll, object *skill)
 Called by write_on_item() to inscribe spell scrolls that the player can cast. More...
 

Function Documentation

static int adj_stealchance ( object op,
object victim,
int  roll 
)
static

Computes stealing chance.

Increased values indicate better attempts.

Parameters
opwho is stealing.
victimwho to steal from.
rolldice roll.
Returns
-1 if op can't steal, else adjusted roll value.
Todo:
rename roll to something more meaningful (check attempt_steal()).

Definition at line 42 of file skills.c.

References ARMOUR, BODY_ARMS, obj::body_info, obj::body_used, BOW, draw_ext_info(), FLAG_APPLIED, FLAG_SLEEP, FLAG_UNAGGRESSIVE, FOR_INV_FINISH, FOR_INV_PREPARE, GLOVES, obj::invisible, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, PLAYER, QUERY_FLAG, SHIELD, obj::type, and WEAPON.

Referenced by attempt_steal().

Here is the call graph for this function:

Here is the caller graph for this function:

static int attempt_hide ( object op,
object skill 
)
static

Someone is trying to hide.

The user becomes undetectable (not just 'invisible') for a short while (success and duration dependant on player SK_level, dexterity, charisma, and map difficulty). Players have a good chance of becoming 'unhidden' if they move and like invisiblity will be come visible if they attack Implemented by b.t. (thoma.nosp@m.s@as.nosp@m.tro.p.nosp@m.su.e.nosp@m.du) July 7, 1995 - made hiding possible for monsters. -b.t.

Parameters
opliving trying to hide.
skillhiding skill.
Return values
0op couldn't hide.
1op successfully hide.

Definition at line 460 of file skills.c.

References obj::contr, liv::Dex, die_roll(), mapdef::difficulty, obj::hide, hideability(), obj::invisible, obj::level, obj::map, PLAYER, PREFER_LOW, stand_near_hostile(), obj::stats, pl::tmp_invis, and obj::type.

Referenced by hide().

Here is the call graph for this function:

Here is the caller graph for this function:

static int attempt_jump ( object pl,
int  dir,
int  spaces,
object skill 
)
static

Someone is trying to jump.

Parameters
plliving trying to jump.
dirdirection to jump in.
spacesdistance to jump.
skilljumping skill.
Returns
1 if jump was successful, 0 else.

Make sure we aren't in a transport. This should be set to null if we aren't.

Definition at line 549 of file skills.c.

References obj::contr, draw_ext_info(), draw_ext_info_format(), esrv_map_scroll(), obj::facing, FLAG_MONSTER, FLAG_WIZ, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, HEAD, obj::map, MAX_BUF, MOVE_FLY_LOW, obj::move_type, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, OB_TYPE_MOVE_BLOCK, object_remove(), P_OUT_OF_MAP, pl::party, PLAYER, QUERY_FLAG, query_name(), skill_attack(), pl::socket, stop_jump(), pl::transport, obj::type, obj::x, and obj::y.

Referenced by jump().

Here is the call graph for this function:

Here is the caller graph for this function:

static int attempt_pick_lock ( object door,
object pl,
object skill 
)
static

Attempt to pick a lock.

Handles traps.

Parameters
doorlock to pick.
plplayer picking.
skilllocking skill.
Return values
0no lock was picked.
1door was locked.

Definition at line 352 of file skills.c.

References die_roll(), mapdef::difficulty, obj::inv, obj::level, obj::map, PREFER_LOW, remove_door(), RUNE, spring_trap(), TRAP, and obj::type.

Referenced by pick_lock().

Here is the call graph for this function:

Here is the caller graph for this function:

static int attempt_steal ( object op,
object who,
object skill 
)
static

Steal objects.

When stealing: dependent on the intelligence/wisdom of whom you're stealing from (op in attempt_steal), offset by your dexterity and skill at stealing. They may notice your attempt, whether successful or not.

Parameters
optarget (person being pilfered).
whoperson doing the stealing.
skillstealing skill object.
Return values
0nothing was stolen.
1something was stolen.

Definition at line 110 of file skills.c.

References adj_stealchance(), CLEAR_FLAG, liv::Dex, die_roll(), draw_ext_info(), draw_ext_info_format(), FLAG_APPLIED, FLAG_INV_LOCKED, FLAG_NO_STEAL, FLAG_STARTEQUIP, FLAG_UNAGGRESSIVE, FLAG_WAS_WIZ, FLAG_WIZ, FOR_INV_FINISH, FOR_INV_PREPARE, obj::hide, liv::Int, obj::invisible, obj::level, make_visible(), MAX_BUF, Settings::max_stat, monster_can_detect_enemy(), monster_npc_call_help(), MSG_TYPE_ITEM, MSG_TYPE_ITEM_REMOVE, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_VICTIM, MSG_TYPE_VICTIM_STEAL, NDI_UNIQUE, Settings::no_player_stealing, object_was_destroyed, pick_up(), PLAYER, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), SET_FLAG, settings, snprintf, SPELL, obj::stats, obj::type, and liv::Wis.

Referenced by steal().

Here is the call graph for this function:

Here is the caller graph for this function:

int detect_curse_on_item ( object pl,
object tmp,
object skill 
)

Runs a 'detect curse' check on a given item.

Parameters
plplayer detecting a curse.
tmpobject to check for curse
skilldetect skill object.
Returns
amount of experience gained (on successful detecting).

Definition at line 695 of file skills.c.

References calc_skill_exp(), esrv_update_item(), FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_KNOWN_CURSED, obj::item_power, obj::level, QUERY_FLAG, SET_FLAG, and UPD_FLAGS.

Referenced by do_skill_detect_curse(), and examine().

Here is the call graph for this function:

Here is the caller graph for this function:

int detect_magic_on_item ( object pl,
object tmp,
object skill 
)

Runs a 'detect magic' check on a given item.

Parameters
plplayer detecting magic.
tmpobject to check for magic
skilldetect skill object.
Returns
amount of experience gained (on successful detecting).

Definition at line 744 of file skills.c.

References calc_skill_exp(), esrv_update_item(), FLAG_IDENTIFIED, FLAG_KNOWN_MAGICAL, is_magical(), obj::item_power, obj::level, QUERY_FLAG, SET_FLAG, and UPD_FLAGS.

Referenced by do_skill_detect_magic(), and examine().

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_skill_detect_curse ( object pl,
object skill 
)
static

Check for cursed object with the 'detect curse' skill.

Parameters
plplayer detecting.
skilldetect skill object.
Returns
amount of experience gained (on successful detecting).

Definition at line 715 of file skills.c.

References detect_curse_on_item(), FLAG_IS_CAULDRON, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, obj::map, object_can_pick(), QUERY_FLAG, obj::x, and obj::y.

Referenced by skill_ident().

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_skill_detect_magic ( object pl,
object skill 
)
static

Check for magic object with the 'detect magic' skill.

Parameters
plplayer detecting.
skilldetect skill object.
Returns
amount of experience gained (on successful detecting).

Definition at line 764 of file skills.c.

References detect_magic_on_item(), FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, obj::map, object_can_pick(), obj::x, and obj::y.

Referenced by skill_ident().

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_skill_ident ( object pl,
int  obj_class,
object skill 
)
static

Workhorse for skill_ident() -b.t.

Parameters
plplayer identifying.
obj_classtype of objects to identify.
skillskill to give experience to.
Returns
experience gained by identifying items.

Definition at line 842 of file skills.c.

References can_see_monsterP(), FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), identify_object_with_skill(), obj::level, obj::map, P_OUT_OF_MAP, obj::x, and obj::y.

Referenced by skill_ident().

Here is the call graph for this function:

Here is the caller graph for this function:

static int do_throw ( object op,
object part,
object toss_item,
int  dir,
object skill 
)
static

Op throws any object toss_item.

This code was borrowed from fire_bow.

Parameters
opliving thing throwing something.
partpart of op throwing.
toss_itemitem thrown.
dirdirection to throw.
skillthrowing skill.
Return values
0skill use failed.
1skill was successfully used.
Todo:
this messy function should probably be simplified.

Definition at line 1960 of file skills.c.

References add_string(), obj::carrying, cast_dust(), obj::count, liv::dam, liv::Dex, obj::direction, draw_ext_info(), draw_ext_info_format(), EVENT_THROW, execute_event(), FLAG_IS_THROWN, FLAG_STARTEQUIP, liv::food, FREE_PLAYER_LOAD_PERCENT, free_string(), freearr_x, freearr_y, GET_ANIM_ID, get_dam_bonus(), get_dex_bonus(), get_map_flags(), GET_MAP_MOVE_BLOCK, get_speed_bonus(), get_thaco_bonus(), get_weight_limit(), obj::inv, obj::last_sp, obj::level, llevDebug, LOG(), M_CLOTH, M_GLASS, M_LEATHER, M_ORGANIC, M_PAPER, obj::magic, make_throw_ob(), obj::map, obj::material, MAX_BUF, Settings::max_stat, MIN, MOVE_FLY_LOW, obj::move_on, obj::move_type, MOVE_WALK, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, obj::name, NDI_UNIQUE, NUM_ANIMATIONS, ob_process(), object_insert_in_map_at(), object_insert_in_ob(), object_remove(), object_set_owner(), object_split(), object_update_speed(), object_update_turn_face(), object_was_destroyed, P_OUT_OF_MAP, PLAYER, POT_DUST, POTION, QUERY_FLAG, query_name(), SCRIPT_FIX_ACTIVATOR, settings, obj::skill, obj::speed, obj::speed_left, obj::stats, liv::Str, obj::subtype, obj::type, liv::wc, obj::weight, obj::x, and obj::y.

Referenced by skill_throw().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* find_throw_ob ( object op,
sstring  race 
)
static

Find an object to throw.

If there is a suitable marked item, use it. Else find the first item that is of the correct race.

Parameters
opobject wishing to throw.
race'throwing' race.
Returns
throwable object, NULL if none suitable found.

Definition at line 1822 of file skills.c.

References AP_NO_MERGE, AP_UNAPPLY, apply_special(), CONTAINER, draw_ext_info_format(), find_marked_object(), FLAG_APPLIED, FLAG_CURSED, FLAG_DAMNED, FLAG_INV_LOCKED, FLAG_UNPAID, FOR_INV_FINISH, FOR_INV_PREPARE, obj::invisible, llevError, LOG(), MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, QUERY_FLAG, query_name(), obj::type, and WEAPON.

Referenced by skill_throw().

Here is the call graph for this function:

Here is the caller graph for this function:

int find_traps ( object pl,
object skill 
)

Checks for traps on the spaces around the player or in certain objects.

Parameters
plplayer searching.
skillfind trap skill object.
Returns
experience gained for finding traps.

Definition at line 1212 of file skills.c.

References calc_skill_exp(), draw_ext_info(), FLAG_MONSTER, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), obj::map, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, object_get_owner(), P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, TRAP, trap_see(), trap_show(), obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int hide ( object op,
object skill 
)

Main hide handling.

Parameters
opliving trying to hide.
skillhiding skill.
Returns
experience gained for the skill use (can be 0).

Definition at line 491 of file skills.c.

References attempt_hide(), calc_skill_exp(), draw_ext_info(), FLAG_MAKE_INVIS, obj::hide, obj::invisible, obj::level, make_visible(), MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, object_update(), PLAYER, QUERY_FLAG, obj::type, and UP_OBJ_FACE.

Referenced by do_hidden_move(), and do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int identify_object_with_skill ( object tmp,
object pl,
object skill,
int  print_on_success 
)

Helper function for do_skill_ident, so that we can loop over inventory AND objects on the ground conveniently.

Parameters
tmpobject to try to identify.
plobject identifying.
skillidentification skill.
print_on_success1 to print a description if the object is identified, 0 to leave it to the calling function
Returns
experience for successful identification.

Definition at line 796 of file skills.c.

References calc_skill_exp(), die_roll(), draw_ext_info_format(), FLAG_IDENTIFIED, FLAG_NO_SKILL_IDENT, identify(), liv::Int, obj::invisible, obj::item_power, obj::level, obj::magic, MAX_BUF, obj::msg, MSG_TYPE_ITEM, MSG_TYPE_ITEM_INFO, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, need_identify(), ob_describe(), PLAYER, PREFER_LOW, QUERY_FLAG, rndm(), SET_FLAG, obj::stats, and obj::type.

Referenced by do_skill_ident(), and examine().

Here is the call graph for this function:

Here is the caller graph for this function:

int jump ( object pl,
int  dir,
object skill 
)

Jump skill handling.

This is both a new type of movement for player/monsters and an attack as well. Perhaps we should allow more spaces based on level, eg, level 50 jumper can jump several spaces?

Parameters
plobject jumping.
dirdirection to jump to.
skilljumping skill.
Returns
1 if jump was successful, 0 else

Definition at line 658 of file skills.c.

References attempt_jump(), obj::carrying, liv::Dex, draw_ext_info(), obj::level, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, obj::stats, and liv::Str.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

static object* make_throw_ob ( object orig)
static

We construct the 'carrier' object in which we will insert the object that is being thrown.

This combination becomes the 'thrown object'. -b.t.

Parameters
origobject to wrap.
Returns
object to throw.

Definition at line 1919 of file skills.c.

References CLEAR_FLAG, liv::dam, FLAG_APPLIED, FLAG_CHANGING, llevError, LOG(), object_copy(), object_insert_in_ob(), object_new(), QUERY_FLAG, obj::stats, THROWN_OBJ, and obj::type.

Referenced by do_throw().

Here is the call graph for this function:

Here is the caller graph for this function:

void meditate ( object pl,
object skill 
)

Meditation skill handling.

This skill allows the player to regain a few sp or hp for a brief period of concentration. The amount of time needed to concentrate and the # of points regained is dependant on the level of the user.

Depending on the level, the player can wear armour or not.

Author
b.t. thoma.nosp@m.s@as.nosp@m.tro.p.nosp@m.su.e.nosp@m.du
Parameters
pllivng meditating, should be a player.
skillmeditation skill.

Definition at line 1404 of file skills.c.

References ARMOUR, BOOTS, draw_ext_info(), FLAG_APPLIED, FLAG_READY_WEAPON, FOR_INV_FINISH, FOR_INV_PREPARE, GLOVES, HELMET, liv::hp, obj::last_heal, obj::last_sp, obj::level, liv::maxhp, liv::maxsp, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, NDI_UNIQUE, PLAYER, QUERY_FLAG, SHIELD, liv::sp, obj::stats, and obj::type.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int pick_lock ( object pl,
int  dir,
object skill 
)

Lock pick handling.

Implementation by bt. (thoma.nosp@m.s@as.nosp@m.tro.p.nosp@m.su.e.nosp@m.du) monster implementation 7-7-95 by bt.

Parameters
plplayer picking the lock.
dirdirection to pick.
skilllock picking skill.
Returns
experience for picking a lock, 0 if nothing was picked.

Definition at line 386 of file skills.c.

References obj::above, attempt_pick_lock(), calc_skill_exp(), DOOR, draw_ext_info(), EVENT_TRIGGER, execute_event(), obj::facing, freearr_x, freearr_y, GET_MAP_OB, isqrt(), LOCKED_DOOR, obj::map, obj::move_block, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, out_of_map(), SCRIPT_FIX_ALL, obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int pray ( object pl,
object skill 
)

Praying skill handling.

When this skill is called from do_skill(), it allows the player to regain lost grace points at a faster rate. -b.t.

This always returns 0 - return value is used by calling function such that if it returns true, player gets exp in that skill. This the effect here can be done on demand, we probably don't want to give infinite exp by returning true in any cases.

Parameters
plobject praying, should be a player.
skillpraying skill.
Returns
0.

Definition at line 1356 of file skills.c.

References draw_ext_info(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, liv::grace, HOLY_ALTAR, obj::last_grace, MAX_BUF, liv::maxgrace, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, PLAYER, pray_at_altar(), snprintf, obj::stats, and obj::type.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int remove_trap ( object op,
object skill 
)

This skill will disarm any previously discovered trap.

the algorithm is based (almost totally) on the old command_disarm() - b.t.

Parameters
opplayer disarming. Must be on a map.
skilldisarming skill.
Returns
experience gained to disarm.

Definition at line 1283 of file skills.c.

References calc_skill_exp(), FLAG_MONSTER, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), obj::map, object_get_owner(), P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, TRAP, trap_disarm(), trap_show(), obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int singing ( object pl,
int  dir,
object skill 
)

Singing skill handling.

This skill allows the player to pacify nearby creatures. There are few limitations on who/what kind of non-player creatures that may be pacified. Right now, a player may pacify creatures which have Int == 0. In this routine, once successfully pacified the creature gets Int=1. Thus, a player may only pacify a creature once. BTW, I appologize for the naming of the skill, I couldnt think of anything better! -b.t.

Parameters
plplayer singing.
dirdirection to sing in.
skillsinging skill object.
Returns
experience gained for singing.

Definition at line 1119 of file skills.c.

References calc_skill_exp(), liv::Cha, draw_ext_info_format(), FLAG_FRIENDLY, FLAG_HITBACK, FLAG_MONSTER, FLAG_NO_STEAL, FLAG_SPLITTING, FLAG_UNAGGRESSIVE, FLAG_UNDEAD, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), HEAD, liv::Int, obj::level, obj::map, MAX_BUF, MIN, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, object_get_value(), P_IS_ALIVE, P_OUT_OF_MAP, PLAYER, PREFER_HIGH, QUERY_FLAG, query_name(), random_roll(), SET_FLAG, SIZEOFFREE, obj::stats, obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int skill_ident ( object pl,
object skill 
)

Main identification skill handling.

Parameters
plplayer identifying.
skillidentification skill.
Returns
experience gained for identification.

Definition at line 895 of file skills.c.

References do_skill_detect_curse(), do_skill_detect_magic(), do_skill_ident(), draw_ext_info(), get_typedata(), typedata::identifyskill, typedata::identifyskill2, llevError, LOG(), MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, OBJECT_TYPE_MAX, PLAYER, SK_DET_CURSE, SK_DET_MAGIC, obj::subtype, and obj::type.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

int skill_throw ( object op,
object part,
int  dir,
object skill 
)

Throwing skill handling.

Parameters
opobject throwing.
partactual part of op throwing.
dirdirection to throw into.
skillthrowing skill.
Return values
0skill use failed.
1skill was successfully used.

Definition at line 2230 of file skills.c.

References do_throw(), find_string(), find_throw_ob(), monster_find_throw_ob(), PLAYER, and obj::type.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Main stealing function.

Parameters
opthief.
dirdirection to steal from.
skillstealing skill.
Returns
experience gained for stealing, 0 if nothing was stolen.

Definition at line 276 of file skills.c.

References obj::above, obj::attack_movement, attempt_steal(), calc_skill_exp(), obj::contr, FLAG_FRIENDLY, FLAG_MONSTER, FLAG_WIZ, FOR_OB_AND_ABOVE_FINISH, FOR_OB_AND_ABOVE_PREPARE, FOR_OB_AND_BELOW_FINISH, FOR_OB_AND_BELOW_PREPARE, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, GET_MAP_OB, HEAD, pl::hidden, obj::map, OB_TYPE_MOVE_BLOCK, object_get_owner(), P_IS_ALIVE, P_OUT_OF_MAP, PETMOVE, PLAYER, QUERY_FLAG, obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

static void stop_jump ( object pl)
static

End of jump.

Restore the map.

Parameters
plplayer.
Todo:
Is fix_object() required?

Definition at line 531 of file skills.c.

References fix_object(), obj::map, object_insert_in_map_at(), obj::x, and obj::y.

Referenced by attempt_jump().

Here is the call graph for this function:

Here is the caller graph for this function:

int use_oratory ( object pl,
int  dir,
object skill 
)

Oratory skill handling.

Players using this skill can 'charm' a monster – into working for them. It can only be used on non-special (see below) 'neutral' creatures. -b.t. (thoma.nosp@m.s@as.nosp@m.tro.p.nosp@m.su.e.nosp@m.du)

Parameters
plplayer trying to convince a monster.
dirdirection to orate in.
skilloratory skill object.
Returns
experience gained for oratoring.
Todo:
check if can't be simplified, code looks duplicated.

Definition at line 965 of file skills.c.

References add_friendly_object(), obj::attack_movement, calc_skill_exp(), liv::Cha, CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), liv::exp, FLAG_FRIENDLY, FLAG_MONSTER, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_COPY, freearr_x, freearr_y, get_map_flags(), HEAD, liv::Int, obj::level, obj::map, MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, object_get_owner(), object_get_value(), object_set_owner(), P_IS_ALIVE, P_OUT_OF_MAP, PETMOVE, PLAYER, PREFER_HIGH, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), remove_friendly_object(), SET_FLAG, obj::skill, obj::stats, obj::type, obj::x, and obj::y.

Referenced by do_skill().

Here is the call graph for this function:

Here is the caller graph for this function:

static int write_note ( object pl,
object item,
const char *  msg 
)
static

Called by write_on_item() to inscribe a message in an ordinary book.

Parameters
plPlayer attempting to write
itemBook to write the message in
msgMessage to write
Returns
Experience gained from using the skill
Todo:
assert() instead of simple check.

Definition at line 1461 of file skills.c.

References BOOK, BOOK_BUF, book_overflow(), draw_ext_info(), draw_ext_info_format(), EVENT_TRIGGER, execute_event(), obj::msg, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, obj::nrof, object_copy(), object_decrease_nrof_by_one, object_insert_in_ob(), object_new(), object_set_msg(), query_short_name(), SCRIPT_FIX_ALL, snprintf, strcasestr_local, and obj::type.

Referenced by write_on_item().

Here is the call graph for this function:

Here is the caller graph for this function:

int write_on_item ( object pl,
const char *  params,
object skill 
)

Implement the 'inscription' skill, which checks for the required skills and marked items before running either write_note() or write_scroll().

Parameters
plPlayer attempting to write
paramsMessage to write, blank to write a spell
skillWriting skill
Returns
Experience gained from using the skill

Definition at line 1735 of file skills.c.

References BOOK, archt::clone, draw_ext_info(), draw_ext_info_format(), find_marked_object(), find_skill_by_name(), FLAG_BLIND, FLAG_UNPAID, FLAG_WIZ, get_archetype_by_type_subtype(), MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_MISSING, NDI_UNIQUE, PLAYER, QUERY_FLAG, SCROLL, SK_LITERACY, SKILL, obj::skill, obj::type, write_note(), and write_scroll().

Referenced by do_skill(), and inscribe_scroll_cmd().

Here is the call graph for this function:

Here is the caller graph for this function:

static int write_scroll ( object pl,
object scroll,
object skill 
)
static

Called by write_on_item() to inscribe spell scrolls that the player can cast.

Backfire effects are possible, varying in severity depending on the difficulty of the spell being attempted.

Parameters
plplayer writing a scroll.
scrollobject to write into.
skillwriting skill.
Returns
experience gained.

Definition at line 1551 of file skills.c.

References Settings::allow_denied_spells_writing, apply_manual(), obj::arch, calc_skill_exp(), archt::clone, confuse_living(), obj::contr, drain_specific_stat(), draw_ext_info(), draw_ext_info_format(), EVENT_TRIGGER, execute_event(), liv::exp, find_random_spell_in_ob(), FLAG_CONFUSED, FREE_OBJ_NO_DESTROY_CALLBACK, liv::grace, liv::Int, obj::inv, obj::level, MAX, MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, obj::name, NDI_UNIQUE, obj::nrof, object_copy(), object_decrease_nrof_by_one, object_free2(), object_insert_in_ob(), object_new(), object_remove(), obj::path_attuned, obj::path_denied, obj::path_repelled, PREFER_HIGH, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), range_magic, pl::ranges, SCROLL, settings, liv::sp, SP_level_spellpoint_cost(), SPELL_GRACE, SPELL_MANA, obj::stats, obj::type, and obj::value.

Referenced by write_on_item().

Here is the call graph for this function:

Here is the caller graph for this function: