60 if (!op || !victim || !roll)
70 "But you have no free hands to steal with!", NULL);
90 for (equip = op->
inv; equip; equip = equip->
below) {
92 roll -= equip->
weight/10000;
95 roll -= equip->
weight/5000;
97 roll -= equip->
weight/2000;
100 roll -= equip->
weight/5000;
102 roll -= equip->
weight/100;
128 object *success = NULL, *tmp = NULL, *next;
129 int roll = 0, chance = 0, stats_value;
144 "Your attempt is prevented!", NULL);
153 "You can't steal from the dungeon master!", NULL);
158 "You can't steal from other players!", NULL);
164 for (tmp = op->
inv; tmp != NULL; tmp = next) {
181 || tmp->type ==
SPELL
195 else if (roll < chance) {
196 tag_t tmp_count = tmp->count;
216 "%s%s has nothing you can steal!",
217 "%s%s has nothing you can steal!",
227 if ((roll >= skill->
level)
240 "%s notices your attempted pilfering!",
241 "%s notices your attempted pilfering!",
255 snprintf(buf,
sizeof(buf),
"Your %s is missing!", name);
257 snprintf(buf,
sizeof(buf),
"Your pack feels strangely lighter.");
263 snprintf(buf,
sizeof(buf),
"you feel itchy fingers getting at your pack.");
266 snprintf(buf,
sizeof(buf),
"%s looks very shifty.", name);
274 return success ? 1 : 0;
290 int steal(
object *op,
int dir,
object *skill) {
321 for (; tmp != NULL; tmp = next) {
368 int success = 0, number;
411 "There is no lock there.", NULL);
421 "There is no lock there.", NULL);
426 "You can't pick that lock!", NULL);
432 "The door has no lock!", NULL);
438 "You pick the lock.", NULL);
442 "You fail to pick the lock.", NULL);
498 int hide(
object *op,
object *skill) {
504 "You don't need to hide while invisible!", NULL);
508 "Your attempt to hide breaks the invisibility spell!", NULL);
514 "You are as hidden as you can get.", NULL);
520 "You hide in the shadows.", NULL);
525 "You fail to conceal yourself.", NULL);
576 for (i = 0; i <= spaces; i++) {
589 "Your jump is blocked.", NULL);
599 "You jump into %s%s.",
600 "You jump into %s%s.",
651 int jump(
object *
pl,
int dir,
object *skill) {
652 int spaces = 0, stats;
656 dex = dex ? dex : 15;
657 str = str ? str : 10;
659 stats = str*str*str*dex*skill->
level;
668 else if (spaces == 0) {
670 "You are carrying too much weight to jump.", NULL);
690 for (tmp = pl->
inv; tmp; tmp = tmp->
below)
731 for (tmp = pl->
inv; tmp; tmp = tmp->
below)
772 int success = 0, chance, ip;
779 && tmp->
type == obj_class) {
785 if (skill_value >= chance) {
796 "The item has a story:\n%s",
797 "The item has a story:\n%s",
823 int success = 0, area, i;
826 for (tmp = pl->
inv; tmp; tmp = tmp->
below)
834 if (skill->
level > 64) {
836 }
else if (skill->
level > 16) {
838 }
else if (skill->
level > 4) {
844 for (i = 0; i < area; i++) {
879 "You look at the objects nearby...", NULL);
935 "...and discover cursed items!", NULL);
942 "...and discover items imbued with mystic forces!", NULL);
952 "...and learn nothing more.", NULL);
994 "There is nothing to orate to.", NULL);
1018 "There is nothing to orate to.", NULL);
1024 "You orate to the %s.",
1025 "You orate to the %s.",
1034 "Too bad the %s isn't listening!",
1035 "Too bad the %s isn't listening!",
1044 "Your follower loves your speech.", NULL);
1053 "You convince the %s to follow you instead!",
1054 "You convince the %s to follow you instead!",
1073 "You convince the %s to become your follower.",
1074 "You convince the %s to become your follower.",
1089 "Your speech angers the %s!",
1090 "Your speech angers the %s!",
1124 int i, exp = 0, chance, mflags;
1176 "You calm down the %s",
1177 "You calm down the %s",
1187 "Too bad the %s isn't listening!",
1188 "Too bad the %s isn't listening!",
1209 int i, expsum = 0, mflags;
1217 for (i = 0; i < 9; i++) {
1234 for (tmp2 = tmp->
inv; tmp2 != NULL; tmp2 = tmp2->
below)
1257 "You search the area.", NULL);
1274 int i, success = 0, mflags;
1278 for (i = 0; i < 9; i++) {
1295 for (tmp2 = tmp->
inv; tmp2 != NULL; tmp2 = tmp2->
below)
1348 snprintf(buf,
sizeof(buf),
"You pray.");
1355 for (tmp = pl->
below; tmp != NULL; tmp = tmp->
below) {
1358 snprintf(buf,
sizeof(buf),
"You pray over the %s.", tmp->
name);
1399 "You can't concentrate while wielding a weapon!", NULL);
1402 for (tmp = pl->
inv; tmp; tmp = tmp->
below)
1410 "You can't concentrate while wearing so much armour!", NULL);
1424 "You meditate.", NULL);
1451 static int write_note(
object *
pl,
object *item,
const char *msg,
object *skill) {
1453 object *newBook = NULL;
1461 "No message to write!\nUsage: use_skill %s <message>",
1462 "No message to write!\nUsage: use_skill %s <message>",
1468 "Trying to cheat now are we?", NULL);
1479 snprintf(buf,
sizeof(buf),
"%s%s\n", item->
msg, msg);
1481 snprintf(buf,
sizeof(buf),
"%s\n", msg);
1483 if (item->
nrof > 1) {
1503 "You write in the %s.",
1504 "You write in the %s.",
1510 "Your message won't fit in the %s!",
1511 "Your message won't fit in the %s!",
1533 int success = 0, confused = 0, grace_cost = 0;
1534 object *newscroll, *chosen_spell, *tmp;
1539 "A spell can only be inscribed into a scroll!", NULL);
1545 if (!chosen_spell) {
1547 "You need a spell readied in order to inscribe!", NULL);
1552 if (grace_cost > 0 && grace_cost > pl->
stats.
grace) {
1554 "You don't have enough grace to write a scroll of %s.",
1555 "You don't have enough grace to write a scroll of %s.",
1556 chosen_spell->
name);
1561 "You don't have enough mana to write a scroll of %s.",
1562 "You don't have enough mana to write a scroll of %s.",
1563 chosen_spell->
name);
1574 "The simple idea of writing a scroll of %s makes you sick !",
1575 "The simple idea of writing a scroll of %s makes you sick !",
1587 "Oops! You accidently read it while trying to write on it.", NULL);
1604 if (scroll->
nrof > 1) {
1608 newscroll->
nrof = 1;
1616 "You succeed in writing a new scroll.", NULL);
1624 "In your confused state, you write down some odd spell.", NULL);
1627 if (newscroll->
inv) {
1630 ninv = newscroll->
inv;
1648 if (newscroll == scroll) {
1656 success = success*skill->
level;
1661 if (chosen_spell->
level > skill->
level || confused) {
1663 "Ouch! Your attempt to write a new scroll strains your mind!", NULL);
1668 return (-30*chosen_spell->
level);
1672 "Your attempt to write a new scroll rattles your mind!", NULL);
1676 "You fail to write a new scroll.", NULL);
1697 const char *
string = params;
1713 "You must learn to read before you can write!", NULL);
1719 "You are unable to write while blind.", NULL);
1727 msgtype = (
string[0] !=
'\0') ?
BOOK :
SCROLL;
1732 "You don't have any marked item to write on.", NULL);
1738 "You had better pay for that before you write on it.", NULL);
1741 if (msgtype != item->
type) {
1743 "You have no %s to write %s",
1744 "You have no %s to write %s",
1745 msgtype ==
BOOK ?
"book" :
"scroll",
1746 msgtype ==
BOOK ?
"on" :
"your spell down");
1752 }
else if (msgtype ==
BOOK) {
1782 LOG(
llevError,
"find_throw_ob(): confused! have a NULL thrower!\n");
1783 return (
object *)NULL;
1797 for (tmp = op->
inv; tmp != NULL; tmp = tmp->
below) {
1803 || !strcmp(name, request)
1804 || !strcmp(tmp->
name, request))
1820 "You can't throw %s.",
1821 "You can't throw %s.",
1828 "The %s sticks to your hand!",
1829 "The %s sticks to your hand!",
1834 LOG(
llevError,
"BUG: find_throw_ob(): couldn't unapply\n");
1841 "You should pay for the %s first.",
1842 "You should pay for the %s first.",
1848 LOG(
llevError,
"BUG: find_throw_ob(): object is locked\n");
1873 LOG(
llevError,
"BUG: make_throw_ob(): ob is applied\n");
1906 static int do_throw(
object *op,
object *part,
object *toss_item,
int dir,
object *skill) {
1907 object *throw_ob = toss_item, *left = NULL;
1909 int eff_str = 0, maxc, str = op->
stats.
Str, dam = 0;
1910 int pause_f, weight_f = 0, mflags;
1911 float str_factor = 1.0, load_factor = 1.0, item_factor = 1.0;
1917 if (throw_ob == NULL) {
1920 "You have nothing to throw.", NULL);
1927 "The gods won't let you throw that.", NULL);
1939 str_factor = (float)str/(
float)
MAX_STAT;
1947 load_factor = (float)maxc/(
float) op->
carrying;
1950 if (throw_ob->
weight > 0)
1951 item_factor = (float) maxc/(
float) (3.0 * throw_ob->
weight);
1955 "You can't throw %s.",
1956 "You can't throw %s.",
1961 eff_str = str*
MIN(load_factor, 1.0);
1962 eff_str = (float)eff_str*item_factor*str_factor;
1989 throw_ob->
x = part->
x; throw_ob->
y = part->
y;
1995 "Your load is so heavy you drop %s to the ground.",
1996 "Your load is so heavy you drop %s to the ground.",
2001 "You throw %s at the ground.",
2002 "You throw %s at the ground.",
2006 "Something is in the way.", NULL);
2013 left_tag = left->
count;
2019 if ((throw_ob =
get_split_ob(throw_ob, 1, NULL, 0)) == NULL) {
2035 throw_ob = toss_item;
2036 if (throw_ob->
skill)
2051 throw_ob->
x = part->
x;
2052 throw_ob->
y = part->
y;
2060 throw_ob->
last_sp = (eff_str*3)/5;
2068 throw_ob->
stats.
dam += (dam/3)+dam_bonus[weight_f]+(throw_ob->
weight/15000)-2;
2083 throw_ob->
last_sp += eff_str/3;
2104 throw_ob->
speed *= 0.8;
2109 if (throw_ob->
weight > 500)
2110 throw_ob->
speed *= 0.8;
2111 if (throw_ob->
weight > 50)
2112 throw_ob->
speed *= 0.5;
2119 if (throw_ob->
last_sp > eff_str)
2129 pause_f = ((2*eff_str)/3)+20+skill->
level;
2145 throw_ob->
map = part->
map;
2157 tag = throw_ob->
count;
2181 int skill_throw(
object *op,
object *part,
int dir,
const char *params,
object *skill) {
2189 return do_throw(op, part, throw_ob, dir, skill);
void spring_trap(object *trap, object *victim)
#define MSG_TYPE_SKILL_MISSING
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
int apply_special(object *who, object *op, int aflags)
static object * make_throw_ob(object *orig)
static int adj_stealchance(object *op, object *victim, int roll)
void set_owner(object *op, object *owner)
int is_magical(const object *op)
const int dam_bonus[MAX_STAT+1]
void remove_door(object *op)
static int attempt_jump(object *pl, int dir, int spaces, object *skill)
static int do_skill_ident(object *pl, int obj_class, object *skill)
static object * find_throw_ob(object *op, const char *request)
void cast_dust(object *op, object *throw_ob, int dir)
static int attempt_hide(object *op, object *skill)
const int dex_bonus[MAX_STAT+1]
static int do_skill_detect_magic(object *pl, object *skill)
void free_string(sstring str)
#define SET_ANIMATION(ob, newanim)
void esrv_update_item(int flags, object *pl, object *op)
#define MSG_TYPE_SKILL_FAILURE
void pick_up(object *op, object *alt)
short freearr_x[SIZEOFFREE]
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
object * ranges[range_size]
void meditate(object *pl, object *skill)
int pray(object *pl, object *skill)
void update_object(object *op, int action)
int stand_near_hostile(object *who)
int singing(object *pl, int dir, object *skill)
method_ret ob_process(object *op)
int trap_disarm(object *disarmer, object *trap, int risk, object *skill)
int manual_apply(object *op, object *tmp, int aflag)
void remove_friendly_object(object *op)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *new_format, const char *old_format,...)
object * find_mon_throw_ob(object *op)
struct archt * other_arch
static int do_skill_ident2(object *tmp, object *pl, int obj_class, object *skill)
int pick_lock(object *pl, int dir, object *skill)
short freearr_y[SIZEOFFREE]
#define FLAG_KNOWN_MAGICAL
#define MSG_TYPE_SKILL_ERROR
int rndm(int min, int max)
int trap_show(object *trap, object *where)
void remove_ob(object *op)
#define MSG_TYPE_ITEM_REMOVE
void confuse_living(object *op, object *hitter, int dam)
#define MSG_TYPE_SKILL_SUCCESS
static int do_throw(object *op, object *part, object *toss_item, int dir, object *skill)
const int thaco_bonus[MAX_STAT+1]
int skill_attack(object *tmp, object *pl, int dir, const char *string, object *skill)
int hide(object *op, object *skill)
#define FLAG_UNAGGRESSIVE
#define MSG_TYPE_ITEM_INFO
#define MSG_TYPE_VICTIM_STEAL
int remove_trap(object *op, object *skill)
void drain_specific_stat(object *op, int deplete_stats)
const float speed_bonus[MAX_STAT+1]
int write_on_item(object *pl, const char *params, object *skill)
void identify(object *op)
sint64 calc_skill_exp(object *who, object *op, object *skill)
int die_roll(int num, int size, const object *op, int goodbad)
void add_friendly_object(object *op)
#define MSG_TYPE_ATTRIBUTE
int steal(object *op, int dir, object *skill)
object * get_owner(object *op)
int can_detect_enemy(object *op, object *enemy, rv_vector *rv)
#define OB_TYPE_MOVE_BLOCK(ob1, type)
#define GET_MAP_MOVE_BLOCK(M, X, Y)
int can_pick(const object *who, const object *item)
int trap_see(object *op, object *trap)
object * find_marked_object(object *op)
#define QUERY_FLAG(xyz, p)
#define CLEAR_FLAG(xyz, p)
static void stop_jump(object *pl)
object * insert_ob_in_ob(object *op, object *where)
char * ob_describe(const object *op, const object *observer, char *buf, size_t size)
object * get_object(void)
object * insert_ob_in_map(object *op, mapstruct *m, object *originator, int flag)
int find_traps(object *pl, object *skill)
static int write_note(object *pl, object *item, const char *msg, object *skill)
void esrv_map_scroll(socket_struct *ns, int dx, int dy)
static int attempt_pick_lock(object *door, object *pl, object *skill)
#define FLAG_READY_WEAPON
void npc_call_help(object *op)
#define FLAG_KNOWN_CURSED
int need_identify(const object *op)
sint8 body_info[NUM_BODY_LOCATIONS]
int snprintf(char *dest, int max, const char *format,...)
sint8 body_used[NUM_BODY_LOCATIONS]
void pray_at_altar(object *pl, object *altar, object *skill)
#define FREE_AND_COPY(sv, nv)
object * find_random_spell_in_ob(object *ob, const char *skill)
#define NUM_ANIMATIONS(ob)
archetype * get_archetype_by_type_subtype(int type, int subtype)
static int write_scroll(object *pl, object *scroll, object *skill)
static int do_skill_detect_curse(object *pl, object *skill)
int book_overflow(const char *buf1, const char *buf2, size_t booksize)
void query_short_name(const object *op, char *buf, size_t size)
int out_of_map(mapstruct *m, int x, int y)
int execute_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
sint16 SP_level_spellpoint_cost(object *caster, object *spell, int flags)
const uint32 weight_limit[MAX_STAT+1]
int hideability(object *ob)
#define MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END
void update_ob_speed(object *op)
sstring add_string(const char *str)
#define GET_MAP_OB(M, X, Y)
int skill_throw(object *op, object *part, int dir, const char *params, object *skill)
int use_oratory(object *pl, int dir, object *skill)
void LOG(LogLevel logLevel, const char *format,...)
const char * strcasestr_local(const char *s, const char *find)
object * get_split_ob(object *orig_ob, uint32 nr, char *err, size_t size)
#define SCRIPT_FIX_ACTIVATOR
void make_visible(object *op)
#define was_destroyed(op, old_tag)
static int attempt_steal(object *op, object *who, object *skill)
int can_see_monsterP(mapstruct *m, int x, int y, int dir)
void copy_object(object *op2, object *op)
int jump(object *pl, int dir, object *skill)
void query_name(const object *op, char *buf, size_t size)
int allow_denied_spells_writing
void free_object(object *ob)
int random_roll(int min, int max, const object *op, int goodbad)
#define FLAG_NO_SKILL_IDENT
int skill_ident(object *pl, object *skill)
void fix_object(object *op)
object * find_skill_by_name(object *who, const char *name)
const int max_carry[MAX_STAT+1]