Crossfire Server, Trunk
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.

Macros

#define _GNU_SOURCE
 

Functions

static int adj_stealchance (object *op, object *victim, int roll)
 
static int attempt_hide (object *op, object *skill)
 
static int attempt_jump (object *pl, int dir, int spaces, object *skill)
 
static int attempt_pick_lock (object *door, object *pl, object *skill)
 
static int attempt_steal (object *op, object *who, object *skill)
 
int detect_curse_on_item (object *pl, object *tmp, object *skill)
 
int detect_magic_on_item (object *pl, object *tmp, object *skill)
 
static int do_skill_detect_curse (object *pl, object *skill)
 
static int do_skill_detect_magic (object *pl, object *skill)
 
static int do_skill_ident (object *pl, int obj_class, object *skill)
 
static int do_throw (object *op, object *part, object *toss_item, int dir, object *skill)
 
static objectfind_throw_ob (object *op, sstring race)
 
int find_traps (object *pl, object *skill)
 
int hide (object *op, object *skill)
 
int identify_object_with_skill (object *tmp, object *pl, object *skill, int print_on_success)
 
int jump (object *pl, int dir, object *skill)
 
static objectmake_throw_ob (object *orig)
 
void meditate (object *pl, object *skill)
 
int pick_lock (object *pl, int dir, object *skill)
 
int pray (object *pl, object *skill)
 
int remove_trap (object *op, object *skill)
 
int singing (object *pl, int dir, object *skill)
 
int skill_ident (object *pl, object *skill)
 
int skill_throw (object *op, object *part, int dir, object *skill)
 
int steal (object *op, int dir, object *skill)
 
static void stop_jump (object *pl)
 
int use_oratory (object *pl, int dir, object *skill)
 
static int write_note (object *pl, object *item, const char *msg)
 
int write_on_item (object *pl, const char *params, object *skill)
 
static int write_scroll (object *pl, object *scroll, object *skill)
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Definition at line 15 of file skills.c.

Function Documentation

◆ adj_stealchance()

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 43 of file skills.c.

References ARMOUR, BODY_ARMS, BOW, draw_ext_info(), FLAG_APPLIED, FLAG_SLEEP, FLAG_UNAGGRESSIVE, FOR_INV_FINISH, FOR_INV_PREPARE, GLOVES, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, give::op, PLAYER, QUERY_FLAG, SHIELD, reputation::victim, and WEAPON.

Referenced by attempt_steal().

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

◆ attempt_hide()

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 463 of file skills.c.

References die_roll(), hideability(), obj::level, give::op, PLAYER, PREFER_LOW, and stand_near_hostile().

Referenced by hide().

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

◆ attempt_jump()

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 555 of file skills.c.

References draw_ext_info(), draw_ext_info_format(), esrv_map_scroll(), FLAG_MONSTER, FLAG_WIZ, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, get_map_flags(), GET_MAP_MOVE_BLOCK, HEAD, m, MAX_BUF, MOVE_FLY_LOW, 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(), Ice::tmp, pl::transport, nlohmann::detail::void(), diamondslots::x, and diamondslots::y.

Referenced by jump().

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

◆ attempt_pick_lock()

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 353 of file skills.c.

References die_roll(), obj::inv, obj::level, 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:

◆ attempt_steal()

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 111 of file skills.c.

References adj_stealchance(), buf, CLEAR_FLAG, 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, commongive::inv, 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, give::name, NDI_UNIQUE, Settings::no_player_stealing, object_was_destroyed, give::op, pick_up(), PLAYER, PREFER_LOW, QUERY_FLAG, query_name(), random_roll(), SET_FLAG, settings, SPELL, Ice::tmp, and autojail::who.

Referenced by steal().

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

◆ detect_curse_on_item()

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 701 of file skills.c.

References calc_skill_exp(), esrv_update_item(), FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_KNOWN_CURSED, obj::level, NROF(), QUERY_FLAG, SET_FLAG, Ice::tmp, 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:

◆ detect_magic_on_item()

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 750 of file skills.c.

References calc_skill_exp(), esrv_update_item(), FLAG_KNOWN_MAGICAL, is_magical(), obj::level, NROF(), QUERY_FLAG, SET_FLAG, Ice::tmp, 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:

◆ do_skill_detect_curse()

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 721 of file skills.c.

References detect_curse_on_item(), FLAG_IS_CAULDRON, FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, object_can_pick(), QUERY_FLAG, and Ice::tmp.

Referenced by skill_ident().

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

◆ do_skill_detect_magic()

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 770 of file skills.c.

References detect_magic_on_item(), FOR_INV_FINISH, FOR_INV_PREPARE, FOR_MAP_FINISH, FOR_MAP_PREPARE, object_can_pick(), and Ice::tmp.

Referenced by skill_ident().

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

◆ do_skill_ident()

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 872 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, m, P_OUT_OF_MAP, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by skill_ident().

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

◆ do_throw()

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.

Fixed logic here

The old code made you have a better factor the more encumbered past the LOAD_PCT you were. This new way essentially flips the variable to be higher at lower encumbrance.

It also only encumbers throwing once carryng more than FREE_PLAYER_LOAD_PERCENT of our capacity, since we have a MIN on load_factor when we use it, so before the limit it is clipped to 1.0.

Also ,use 2.0f since op->carrying/(get_weight_limit(op->stats.Str)*FREE_PLAYER_LOAD_PERCENT) = 1 if they are equal. As op->carrying increases, this slides higher, making the factor lower.

SilverNexus 2019-01-03

Definition at line 1985 of file skills.c.

References add_string(), cast_dust(), obj::count, liv::dam, obj::direction, draw_ext_info(), draw_ext_info_format(), EVENT_THROW, events_execute_object_event(), FLAG_IS_THROWN, FLAG_REFLECTING, 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, 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, give::name, 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, give::op, P_OUT_OF_MAP, PLAYER, POT_DUST, POTION, QUERY_FLAG, query_name(), SCRIPT_FIX_ACTIVATOR, SET_FLAG, settings, obj::skill, obj::speed, obj::speed_left, obj::stats, make_face_from_files::str, obj::subtype, CFweardisguise::tag, 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:

◆ find_throw_ob()

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 1847 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, llevError, LOG(), MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, give::name, NDI_UNIQUE, give::op, QUERY_FLAG, query_name(), Ice::tmp, and WEAPON.

Referenced by skill_throw().

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

◆ find_traps()

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 1238 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(), m, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, object_get_owner(), P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, Ice::tmp, TRAP, trap_see(), trap_show(), obj::type, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ hide()

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 494 of file skills.c.

References attempt_hide(), calc_skill_exp(), draw_ext_info(), FLAG_MAKE_INVIS, 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(), give::op, PLAYER, QUERY_FLAG, 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:

◆ identify_object_with_skill()

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.

Identification will be attempted as many times as NROF(tmp), and tmp will be split if needed. This is to allow players to maximise experience for identification without having to resort to picking one item, moving, attempting identification of the item, and such.

See https://sourceforge.net/p/crossfire/feature-requests/244/

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 808 of file skills.c.

References calc_skill_exp(), die_roll(), draw_ext_info_format(), obj::env, FLAG_NO_SKILL_IDENT, identify(), if(), INS_BELOW_ORIGINATOR, is_identified(), obj::level, obj::map, MAX_BUF, MSG_TYPE_ITEM, MSG_TYPE_ITEM_INFO, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, NROF(), ob_describe(), object_insert_in_map_at(), object_insert_in_ob(), object_merge(), object_split(), PLAYER, PREFER_LOW, QUERY_FLAG, rndm(), SET_FLAG, Ice::tmp, obj::x, and obj::y.

Referenced by do_skill_ident(), and examine().

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

◆ jump()

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 664 of file skills.c.

References attempt_jump(), draw_ext_info(), make_face_from_files::int, obj::level, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, NDI_UNIQUE, and make_face_from_files::str.

Referenced by do_skill().

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

◆ make_throw_ob()

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 1944 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:

◆ meditate()

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 1430 of file skills.c.

References ARMOUR, BOOTS, draw_ext_info(), FLAG_APPLIED, FLAG_READY_WEAPON, FOR_INV_FINISH, FOR_INV_PREPARE, GLOVES, HELMET, obj::level, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, NDI_UNIQUE, PLAYER, QUERY_FLAG, SHIELD, and Ice::tmp.

Referenced by do_skill().

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

◆ pick_lock()

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 389 of file skills.c.

References attempt_pick_lock(), calc_skill_exp(), DOOR, draw_ext_info(), EVENT_TRIGGER, events_execute_object_event(), freearr_x, freearr_y, GET_MAP_OB, isqrt(), LOCKED_DOOR, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, NDI_UNIQUE, OUT_OF_REAL_MAP, SCRIPT_FIX_ALL, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ pray()

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 1382 of file skills.c.

References buf, draw_ext_info(), FOR_BELOW_FINISH, FOR_BELOW_PREPARE, HOLY_ALTAR, MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_SUCCESS, NDI_BLACK, PLAYER, pray_at_altar(), and Ice::tmp.

Referenced by do_skill().

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

◆ remove_trap()

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 1309 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(), m, object_get_owner(), give::op, P_OUT_OF_MAP, PLAYER, QUERY_FLAG, RUNE, Ice::tmp, TRAP, trap_disarm(), trap_show(), obj::type, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ singing()

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 1147 of file skills.c.

References calc_skill_exp(), 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, obj::level, m, MAX_BUF, MIN, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, give::name, NDI_UNIQUE, object_value_set(), P_IS_ALIVE, P_OUT_OF_MAP, PLAYER, PREFER_HIGH, QUERY_FLAG, query_name(), random_roll(), SET_FLAG, SIZEOFFREE, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ skill_ident()

int skill_ident ( object pl,
object skill 
)

Main identification skill handling.

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

Definition at line 925 of file skills.c.

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

Referenced by do_skill().

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

◆ skill_throw()

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 2275 of file skills.c.

References do_throw(), find_string(), find_throw_ob(), monster_find_throw_ob(), give::op, and PLAYER.

Referenced by do_skill().

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

◆ steal()

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 277 of file skills.c.

References attempt_steal(), calc_skill_exp(), 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, m, OB_TYPE_MOVE_BLOCK, object_get_owner(), give::op, P_IS_ALIVE, P_OUT_OF_MAP, PETMOVE, PLAYER, QUERY_FLAG, Ice::tmp, obj::type, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ stop_jump()

static void stop_jump ( object pl)
static

End of jump. Restore the map.

Parameters
plplayer.
Todo:
Is fix_object() required?

Definition at line 534 of file skills.c.

References check_pick(), fix_object(), and object_insert_in_map_at().

Referenced by attempt_jump().

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

◆ use_oratory()

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 994 of file skills.c.

References add_friendly_object(), calc_skill_exp(), CLEAR_FLAG, draw_ext_info(), draw_ext_info_format(), FLAG_FRIENDLY, FLAG_MONSTER, FLAG_UNAGGRESSIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_COPY, freearr_x, freearr_y, get_map_flags(), HEAD, obj::level, m, MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, give::name, NDI_UNIQUE, object_get_owner(), object_set_owner(), object_value_set(), 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, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by do_skill().

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

◆ write_note()

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 1487 of file skills.c.

References BOOK, BOOK_BUF, book_overflow(), buf, draw_ext_info(), draw_ext_info_format(), EVENT_TRIGGER, events_execute_object_event(), navar-midane_pickup::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, and strcasestr_local.

Referenced by write_on_item().

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

◆ write_on_item()

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 1760 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(), say::item, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_MISSING, NDI_UNIQUE, roll-o-matic::params, PLAYER, QUERY_FLAG, SCROLL, SK_LITERACY, SKILL, obj::skill, 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:

◆ write_scroll()

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 1576 of file skills.c.

References Settings::allow_denied_spells_writing, apply_manual(), obj::arch, calc_skill_exp(), archt::clone, confuse_living(), drain_specific_stat(), draw_ext_info(), draw_ext_info_format(), EVENT_TRIGGER, events_execute_object_event(), liv::exp, find_random_spell_in_ob(), FLAG_CONFUSED, FREE_OBJ_NO_DESTROY_CALLBACK, obj::inv, obj::level, MAX, MAX_BUF, MSG_TYPE_SKILL, MSG_TYPE_SKILL_ERROR, MSG_TYPE_SKILL_FAILURE, MSG_TYPE_SKILL_SUCCESS, give::name, obj::name, NDI_UNIQUE, obj::nrof, object_copy(), object_decrease_nrof_by_one, object_free(), object_insert_in_ob(), object_new(), object_remove(), obj::path_attuned, 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, Ice::tmp, 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: