ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skills.C
(Generate patch)

Comparing deliantra/server/server/skills.C (file contents):
Revision 1.48 by root, Mon Apr 21 07:01:40 2008 UTC vs.
Revision 1.64 by root, Tue May 5 04:51:56 2009 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2003,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
41 /* Only prohibit stealing if the player does not have a free 41 /* Only prohibit stealing if the player does not have a free
42 * hand available and in fact does have hands. 42 * hand available and in fact does have hands.
43 */ 43 */
44 if (op->type == PLAYER && op->slot[body_arm].used <= 0 && op->slot[body_arm].info) 44 if (op->type == PLAYER && op->slot[body_arm].used <= 0 && op->slot[body_arm].info)
45 { 45 {
46 new_draw_info (NDI_UNIQUE, 0, op, "But you have no free hands to steal with!"); 46 new_draw_info (NDI_UNIQUE, 0, op, "But you have no free hands to steal with! "
47 "H<Try to unapply weapons or things you hold in your hands, use the C<body> command.>");
47 return -1; 48 return -1;
48 } 49 }
49 50
50 /* ADJUSTMENTS */ 51 /* ADJUSTMENTS */
51 52
64 * it quite a bit harder to steal. 65 * it quite a bit harder to steal.
65 */ 66 */
66 for (equip = op->inv; equip; equip = equip->below) 67 for (equip = op->inv; equip; equip = equip->below)
67 { 68 {
68 if (equip->type == WEAPON && QUERY_FLAG (equip, FLAG_APPLIED)) 69 if (equip->type == WEAPON && QUERY_FLAG (equip, FLAG_APPLIED))
69 {
70 roll -= equip->weight / 10000; 70 roll -= equip->weight / 10000;
71 } 71
72 if (equip->type == BOW && QUERY_FLAG (equip, FLAG_APPLIED)) 72 if (equip->type == BOW && QUERY_FLAG (equip, FLAG_APPLIED))
73 roll -= equip->weight / 5000; 73 roll -= equip->weight / 5000;
74
74 if (equip->type == SHIELD && QUERY_FLAG (equip, FLAG_APPLIED)) 75 if (equip->type == SHIELD && QUERY_FLAG (equip, FLAG_APPLIED))
75 {
76 roll -= equip->weight / 2000; 76 roll -= equip->weight / 2000;
77 } 77
78 if (equip->type == ARMOUR && QUERY_FLAG (equip, FLAG_APPLIED)) 78 if (equip->type == ARMOUR && QUERY_FLAG (equip, FLAG_APPLIED))
79 roll -= equip->weight / 5000; 79 roll -= equip->weight / 5000;
80
80 if (equip->type == GLOVES && QUERY_FLAG (equip, FLAG_APPLIED)) 81 if (equip->type == GLOVES && QUERY_FLAG (equip, FLAG_APPLIED))
81 roll -= equip->weight / 100; 82 roll -= equip->weight / 100;
82 } 83 }
84
83 if (roll < 0) 85 if (roll < 0)
84 roll = 0; 86 roll = 0;
87
85 return roll; 88 return roll;
86} 89}
87 90
88/* 91/*
89 * When stealing: dependent on the intelligence/wisdom of whom you're 92 * When stealing: dependent on the intelligence/wisdom of whom you're
99{ 102{
100 object *success = NULL, *tmp = NULL, *next; 103 object *success = NULL, *tmp = NULL, *next;
101 int roll = 0, chance = 0, stats_value; 104 int roll = 0, chance = 0, stats_value;
102 rv_vector rv; 105 rv_vector rv;
103 106
104 stats_value = ((who->stats.Dex + who->stats.Int) * 3) / 2; 107 stats_value = (who->stats.Dex + who->stats.Int) * 3 / 2;
105 108
106 /* if the victim is aware of a thief in the area (FLAG_NO_STEAL set on them) 109 /* if the victim is aware of a thief in the area (FLAG_NO_STEAL set on them)
107 * they will try to prevent stealing if they can. Only unseen theives will 110 * they will try to prevent stealing if they can. Only unseen theives will
108 * have much chance of success. 111 * have much chance of success.
109 */ 112 */
110 if (op->type != PLAYER && QUERY_FLAG (op, FLAG_NO_STEAL)) 113 if (!op->is_player () && op->flag [FLAG_NO_STEAL])
111 { 114 {
112 if (can_detect_enemy (op, who, &rv)) 115 if (can_detect_enemy (op, who, &rv))
113 { 116 {
114 npc_call_help (op); 117 npc_call_help (op);
115 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); 118 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE);
116 new_draw_info (NDI_UNIQUE, 0, who, "Your attempt is prevented!"); 119 new_draw_info (NDI_UNIQUE, 0, who, "Your attempt is prevented!");
117 return 0; 120 return 0;
118 } 121 }
119 else /* help npc to detect thief next time by raising its wisdom */ 122 else /* help npc to detect thief next time by raising its wisdom */
120 op->stats.Wis += (op->stats.Int / 5) + 1; 123 op->stats.Wis += (op->stats.Int / 5) + 1;
124
121 if (op->stats.Wis > MAX_STAT) 125 if (op->stats.Wis > MAX_STAT)
122 op->stats.Wis = MAX_STAT; 126 op->stats.Wis = MAX_STAT;
123 } 127 }
124 128
125 if (op->type == PLAYER && QUERY_FLAG (op, FLAG_WIZ)) 129 if (op->is_player () && op->flag [FLAG_WIZ])
126 { 130 {
127 new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n"); 131 new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from the dungeon master!\n");
128 return 0; 132 return 0;
129 } 133 }
130 134
131 // only allow stealing between hostile players (TODO: probably should change) 135 // only allow stealing between hostile players (TODO: probably should change)
132 if (op->type == PLAYER && who->type == PLAYER && (who->contr->peaceful || op->contr->peaceful)) 136 if (op->is_player () && who->is_player () && (who->contr->peaceful || op->contr->peaceful))
133 { 137 {
134 new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n"); 138 new_draw_info (NDI_UNIQUE, 0, who, "You can't steal from other players!\n");
135 return 0; 139 return 0;
136 } 140 }
137 141
138 /* Ok then, go thru their inventory, stealing */ 142 /* Ok then, go through their inventory, stealing */
139 for (tmp = op->inv; tmp; tmp = next) 143 for (tmp = op->inv; tmp; tmp = next)
140 { 144 {
141 next = tmp->below; 145 next = tmp->below;
142 146
143 /* you can't steal worn items, starting items, wiz stuff, 147 /* you can't steal worn items, starting items, wiz stuff,
177 if (tmp->destroyed () || tmp->env != op) 181 if (tmp->destroyed () || tmp->env != op)
178 { 182 {
179 /* for players, play_sound: steals item */ 183 /* for players, play_sound: steals item */
180 success = tmp; 184 success = tmp;
181 CLEAR_FLAG (tmp, FLAG_INV_LOCKED); 185 CLEAR_FLAG (tmp, FLAG_INV_LOCKED);
182
183 /* Don't delete it from target player until we know
184 * the thief has picked it up. can't just look at tmp->count,
185 * as it's possible that it got merged when picked up.
186 */
187 if (op->type == PLAYER)
188 esrv_del_item (op->contr, tmp->count);
189 } 186 }
187
190 break; 188 break;
191 } 189 }
192 } /* for loop looking for an item */ 190 } /* for loop looking for an item */
193 191
194 if (!tmp) 192 if (!tmp)
203 */ 201 */
204 202
205 if ((roll >= skill->level) || !chance 203 if ((roll >= skill->level) || !chance
206 || (tmp && tmp->weight > (250 * (random_roll (0, stats_value + skill->level * 10 - 1, who, PREFER_LOW))))) 204 || (tmp && tmp->weight > (250 * (random_roll (0, stats_value + skill->level * 10 - 1, who, PREFER_LOW)))))
207 { 205 {
208
209 /* victim figures out where the thief is! */ 206 /* victim figures out where the thief is! */
210 if (who->hide) 207 if (who->flag [FLAG_HIDDEN])
211 make_visible (who); 208 make_visible (who);
212 209
213 if (op->type != PLAYER) 210 if (op->type != PLAYER)
214 { 211 {
215 /* The unaggressives look after themselves 8) */ 212 /* The unaggressives look after themselves 8) */
216 if (who->type == PLAYER) 213 if (who->type == PLAYER)
217 { 214 {
218 npc_call_help (op); 215 npc_call_help (op);
219 new_draw_info_format (NDI_UNIQUE, 0, who, "%s notices your attempted pilfering!", query_name (op)); 216 new_draw_info_format (NDI_UNIQUE, 0, who, "%s notices your attempted pilfering!", query_name (op));
220 } 217 }
218
221 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE); 219 CLEAR_FLAG (op, FLAG_UNAGGRESSIVE);
222 /* all remaining npc items are guarded now. Set flag NO_STEAL 220 /* all remaining npc items are guarded now. Set flag NO_STEAL
223 * on the victim. 221 * on the victim.
224 */ 222 */
225 SET_FLAG (op, FLAG_NO_STEAL); 223 SET_FLAG (op, FLAG_NO_STEAL);
228 { /* stealing from another player */ 226 { /* stealing from another player */
229 char buf[MAX_BUF]; 227 char buf[MAX_BUF];
230 228
231 /* Notify the other player */ 229 /* Notify the other player */
232 if (success && who->stats.Int > random_roll (0, 19, op, PREFER_LOW)) 230 if (success && who->stats.Int > random_roll (0, 19, op, PREFER_LOW))
233 {
234 sprintf (buf, "Your %s is missing!", query_name (success)); 231 sprintf (buf, "Your %s is missing!", query_name (success));
235 }
236 else 232 else
237 {
238 sprintf (buf, "Your pack feels strangely lighter."); 233 sprintf (buf, "Your pack feels strangely lighter.");
239 } 234
240 new_draw_info (NDI_UNIQUE, 0, op, buf); 235 new_draw_info (NDI_UNIQUE, 0, op, buf);
241 if (!success) 236 if (!success)
242 { 237 {
243 if (who->invisible) 238 if (who->invisible)
244 {
245 sprintf (buf, "you feel itchy fingers getting at your pack."); 239 sprintf (buf, "you feel itchy fingers getting at your pack.");
246 }
247 else 240 else
248 {
249 sprintf (buf, "%s looks very shifty.", query_name (who)); 241 sprintf (buf, "%s looks very shifty.", query_name (who));
250 } 242
251 new_draw_info (NDI_UNIQUE, 0, op, buf); 243 new_draw_info (NDI_UNIQUE, 0, op, buf);
252 } 244 }
253 } /* else stealing from another player */ 245 } /* else stealing from another player */
254 /* play_sound("stop! thief!"); kindofthing */ 246 /* play_sound("stop! thief!"); kindofthing */
255 } /* if you weren't 100% successful */ 247 } /* if you weren't 100% successful */
248
256 return success ? 1 : 0; 249 return success ? 1 : 0;
257} 250}
258 251
259int 252int
260steal (object *op, int dir, object *skill) 253steal (object *op, int dir, object *skill)
437 op->invisible += 100; /* set the level of 'hiddeness' */ 430 op->invisible += 100; /* set the level of 'hiddeness' */
438 431
439 if (op->type == PLAYER) 432 if (op->type == PLAYER)
440 op->contr->tmp_invis = 1; 433 op->contr->tmp_invis = 1;
441 434
442 op->hide = 1; 435 op->flag [FLAG_HIDDEN] = 1;
443 return 1; 436 return 1;
444 } 437 }
445 438
446 return 0; 439 return 0;
447} 440}
456 if (QUERY_FLAG (op, FLAG_MAKE_INVIS)) 449 if (QUERY_FLAG (op, FLAG_MAKE_INVIS))
457 { 450 {
458 new_draw_info (NDI_UNIQUE, 0, op, "You don't need to hide while invisible!"); 451 new_draw_info (NDI_UNIQUE, 0, op, "You don't need to hide while invisible!");
459 return 0; 452 return 0;
460 } 453 }
461 else if (!op->hide && op->invisible > 0 && op->type == PLAYER) 454 else if (!op->flag [FLAG_HIDDEN] && op->invisible > 0 && op->type == PLAYER)
462 { 455 {
463 new_draw_info (NDI_UNIQUE, 0, op, "Your attempt to hide breaks the invisibility spell!"); 456 new_draw_info (NDI_UNIQUE, 0, op, "Your attempt to hide breaks the invisibility spell!");
464 make_visible (op); 457 make_visible (op);
465 } 458 }
466 459
488static void 481static void
489stop_jump (object *pl, int dist, int spaces) 482stop_jump (object *pl, int dist, int spaces)
490{ 483{
491 pl->update_stats (); 484 pl->update_stats ();
492 pl->map->insert (pl, pl->x, pl->y, pl); 485 pl->map->insert (pl, pl->x, pl->y, pl);
486 pl->speed_left -= fabs (pl->speed * 8);
493} 487}
494 488
495static int 489static int
496attempt_jump (object *pl, int dir, int spaces, object *skill) 490attempt_jump (object *pl, int dir, int spaces, object *skill)
497{ 491{
498 object *tmp; 492 object *tmp;
499 int i, exp = 0, dx = freearr_x[dir], dy = freearr_y[dir], mflags; 493 int i, dx = freearr_x[dir], dy = freearr_y[dir], mflags;
500 sint16 x, y; 494 sint16 x, y;
501 maptile *m; 495 maptile *m;
502 496
503 /* Jump loop. Go through spaces object wants to jump. Halt the 497 /* Jump loop. Go through spaces object wants to jump. Halt the
504 * jump if a wall or creature is in the way. We set FLAG_FLYING 498 * jump if a wall or creature is in the way. We set FLAG_FLYING
505 * temporarily to allow player to aviod exits/archs that are not 499 * temporarily to allow player to aviod exits/archs that are not
506 * fly_on, fly_off. This will also prevent pickup of objects 500 * fly_on, fly_off. This will also prevent pickup of objects
507 * while jumping over them. 501 * while jumping over them.
508 */ 502 */
509 pl->remove (); 503 pl->remove ();
510
511 /*
512 * I don't think this is actually needed - all the movement
513 * code is handled in this function, and I don't see anyplace
514 * that cares about the move_type being flying.
515 */
516 pl->move_type |= MOVE_FLY_LOW; 504 pl->move_type |= MOVE_FLY_LOW;
517 505
518 for (i = 0; i <= spaces; i++) 506 for (i = 0; i <= spaces; i++)
519 { 507 {
520 x = pl->x + dx; 508 x = pl->x + dx;
527 { 515 {
528 stop_jump (pl, i, spaces); 516 stop_jump (pl, i, spaces);
529 return 0; 517 return 0;
530 } 518 }
531 519
520 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
521 {
522 /* Jump into creature */
523 if (QUERY_FLAG (tmp, FLAG_MONSTER)
524 || (tmp->type == PLAYER && (!QUERY_FLAG (tmp, FLAG_WIZ) || !tmp->contr->hidden)))
525 {
526 new_draw_info_format (NDI_UNIQUE, 0, pl, "You jump into %s%s.", tmp->type == PLAYER ? "" : "the ", &tmp->name);
527
528 stop_jump (pl, i, spaces);
529
530 int exp = 0;
531
532 if (tmp->type != PLAYER
533 || (pl->type == PLAYER && !pl->contr->party)
534 || (pl->type == PLAYER && tmp->type == PLAYER && pl->contr->party != tmp->contr->party))
535 exp = skill_attack (tmp, pl, pl->facing, "kicked", skill); /* pl makes an attack */
536
537 return exp; /* note that calc_skill_exp() is already called by skill_attack() */
538 }
539 }
540
532 if (OB_TYPE_MOVE_BLOCK (pl, GET_MAP_MOVE_BLOCK (m, x, y))) 541 if (OB_TYPE_MOVE_BLOCK (pl, GET_MAP_MOVE_BLOCK (m, x, y)))
533 { 542 {
534 new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked."); 543 new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is blocked.");
535 stop_jump (pl, i, spaces); 544 stop_jump (pl, i, spaces);
536 return 0; 545 return 0;
537 } 546 }
538 547
539 for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above)
540 {
541 /* Jump into creature */
542 if (QUERY_FLAG (tmp, FLAG_MONSTER) || (tmp->type == PLAYER && (!QUERY_FLAG (tmp, FLAG_WIZ) || !tmp->contr->hidden)))
543 {
544 new_draw_info_format (NDI_UNIQUE, 0, pl, "You jump into %s%s.", tmp->type == PLAYER ? "" : "the ", &tmp->name);
545
546 stop_jump (pl, i, spaces);
547
548 if (tmp->type != PLAYER ||
549 (pl->type == PLAYER && pl->contr->party == NULL) ||
550 (pl->type == PLAYER && tmp->type == PLAYER && pl->contr->party != tmp->contr->party))
551 exp = skill_attack (tmp, pl, pl->facing, "kicked", skill); /* pl makes an attack */
552
553 return exp; /* note that calc_skill_exp() is already called by skill_attack() */
554 }
555
556 /* If the space has fly on set (no matter what the space is),
557 * we should get the effects - after all, the player is
558 * effectively flying.
559 */
560 if (tmp->move_on & MOVE_FLY_LOW)
561 {
562 pl->x = x;
563 pl->y = y;
564 pl->map = m;
565 stop_jump (pl, i, spaces);
566 return calc_skill_exp (pl, NULL, skill);
567 }
568 }
569
570 pl->x = x; 548 pl->x = x;
571 pl->y = y; 549 pl->y = y;
572 pl->map = m; 550 pl->map = m;
551
552 if (m->at (x, y).move_on & pl->move_type)
553 {
554 new_draw_info (NDI_UNIQUE, 0, pl, "Your jump is stopped.");
555 stop_jump (pl, i, spaces);
556 return 0;
557 }
573 } 558 }
574 559
575 stop_jump (pl, i, spaces); 560 stop_jump (pl, i, spaces);
576 561
577 return calc_skill_exp (pl, NULL, skill); 562 return calc_skill_exp (pl, NULL, skill);
697 if (tmp->msg) 682 if (tmp->msg)
698 { 683 {
699 new_draw_info (NDI_UNIQUE, 0, pl, "The item has a story:"); 684 new_draw_info (NDI_UNIQUE, 0, pl, "The item has a story:");
700 new_draw_info (NDI_UNIQUE, 0, pl, tmp->msg); 685 new_draw_info (NDI_UNIQUE, 0, pl, tmp->msg);
701 } 686 }
702
703 /* identify will take care of updating the item if it is in the players inventory. IF on map, do it here */
704 if (tmp->map)
705 esrv_send_item (pl, tmp);
706 } 687 }
688
707 success += calc_skill_exp (pl, tmp, skill); 689 success += calc_skill_exp (pl, tmp, skill);
708 } 690 }
709 else 691 else
710 SET_FLAG (tmp, FLAG_NO_SKILL_IDENT); 692 SET_FLAG (tmp, FLAG_NO_SKILL_IDENT);
711 } 693 }
894 /* Ok, got a 'sucker' lets try to make them a follower */ 876 /* Ok, got a 'sucker' lets try to make them a follower */
895 if (level > 0 && tmp->level < (random_roll (0, level - 1, pl, PREFER_HIGH) - 1)) 877 if (level > 0 && tmp->level < (random_roll (0, level - 1, pl, PREFER_HIGH) - 1))
896 { 878 {
897 new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp)); 879 new_draw_info_format (NDI_UNIQUE, 0, pl, "You convince the %s to become your follower.\n", query_name (tmp));
898 880
881 INVOKE_OBJECT (KILL, tmp, ARG_OBJECT (pl));
899 tmp->set_owner (pl); 882 tmp->set_owner (pl);
900 tmp->skill = skill->skill; 883 tmp->skill = skill->skill;
901 tmp->stats.exp = 0; 884 tmp->stats.exp = 0;
902 tmp->attack_movement = PETMOVE; 885 tmp->attack_movement = PETMOVE;
903 886
1232 * ordinary inscribable 'books' (anything that is not a SPELL). b.t. 1215 * ordinary inscribable 'books' (anything that is not a SPELL). b.t.
1233 */ 1216 */
1234static int 1217static int
1235write_note (object *pl, object *item, const char *msg, object *skill) 1218write_note (object *pl, object *item, const char *msg, object *skill)
1236{ 1219{
1237
1238 if (strstr (msg, "\nendmsg")) 1220 if (strstr (msg, "\nendmsg"))
1239 { 1221 {
1240 new_draw_info (NDI_UNIQUE, 0, pl, "Trying to cheat now are we?"); 1222 new_draw_info (NDI_UNIQUE, 0, pl, "Trying to cheat now are we?");
1241 return 0; 1223 return 0;
1242 } 1224 }
1258 { 1240 {
1259 snprintf (buf, sizeof (buf), "%s\n", msg); 1241 snprintf (buf, sizeof (buf), "%s\n", msg);
1260 1242
1261 object *newbook = arch_to_object (item->other_arch); 1243 object *newbook = arch_to_object (item->other_arch);
1262 item->decrease (); 1244 item->decrease ();
1263 esrv_send_item (pl, item);
1264 newbook->nrof = 1; 1245 newbook->nrof = 1;
1265 newbook->msg = buf; 1246 newbook->msg = buf;
1266 newbook->flag [FLAG_IDENTIFIED] = true; 1247 newbook->flag [FLAG_IDENTIFIED] = true;
1267 1248
1268 if (item->subtype == 1) // mailscrolls 1249 if (item->subtype == 1) // mailscrolls
1269 { 1250 {
1270 newbook->name = item->name; 1251 newbook->name = item->name;
1271 newbook->name_pl = item->name_pl; 1252 newbook->name_pl = item->name_pl;
1272 } 1253 }
1273 1254
1274 newbook = insert_ob_in_ob (newbook, pl); 1255 pl->insert (newbook);
1275 esrv_send_item (pl, newbook);
1276 1256
1277 pl->contr->play_sound (sound_find ("inscribe_success")); 1257 pl->contr->play_sound (sound_find ("inscribe_success"));
1278 new_draw_info_format (NDI_UNIQUE, 0, pl, "You write in the %s.", &item->name); 1258 new_draw_info_format (NDI_UNIQUE, 0, pl, "You write in the %s.", &item->name);
1279 return strlen (msg); 1259 return strlen (msg);
1280 } 1260 }
1354 * if players want to sell them, so be it. 1334 * if players want to sell them, so be it.
1355 */ 1335 */
1356 newscroll->value = newscroll->arch->value * newscroll->inv->value * (newscroll->level + 50) / (newscroll->inv->level + 50); 1336 newscroll->value = newscroll->arch->value * newscroll->inv->value * (newscroll->level + 50) / (newscroll->inv->level + 50);
1357 newscroll->stats.exp = newscroll->value / 5; 1337 newscroll->stats.exp = newscroll->value / 5;
1358 1338
1359 newscroll = insert_ob_in_ob (newscroll, pl); 1339 pl->insert (newscroll);
1360 esrv_send_item (pl, newscroll);
1361 1340
1362 success = calc_skill_exp (pl, newscroll, skill); 1341 success = calc_skill_exp (pl, newscroll, skill);
1363 if (!confused) 1342 if (!confused)
1364 success *= 2; 1343 success *= 2;
1365 1344
1418 object *item = find_marked_object (pl); 1397 object *item = find_marked_object (pl);
1419 1398
1420 /* find an item of correct type to write on */ 1399 /* find an item of correct type to write on */
1421 if (!item) 1400 if (!item)
1422 { 1401 {
1423 new_draw_info (NDI_UNIQUE, 0, pl, "You don't have any marked item to write on. H<Use the mark command or the popup menu to makr an item.>"); 1402 new_draw_info (NDI_UNIQUE, 0, pl, "You don't have any marked item to write on. H<Use the mark command or the popup menu to make an item.>");
1424 return 0; 1403 return 0;
1425 } 1404 }
1426 1405
1427 if (item->type != INSCRIBABLE) 1406 if (item->type != INSCRIBABLE)
1428 { 1407 {
1501 for (tmp = op->inv; tmp != NULL; tmp = tmp->below) 1480 for (tmp = op->inv; tmp != NULL; tmp = tmp->below)
1502 { 1481 {
1503 /* can't toss invisible or inv-locked items */ 1482 /* can't toss invisible or inv-locked items */
1504 if (tmp->invisible || QUERY_FLAG (tmp, FLAG_INV_LOCKED)) 1483 if (tmp->invisible || QUERY_FLAG (tmp, FLAG_INV_LOCKED))
1505 continue; 1484 continue;
1506 if (!request || !strcmp (query_name (tmp), request) || !strcmp (tmp->name, request)) 1485 if (!request || !strcmp (query_name (tmp), request) || !strcmp (&tmp->name, request))
1507 break; 1486 break;
1508 } 1487 }
1509 } 1488 }
1510 1489
1511 /* this should prevent us from throwing away 1490 /* this should prevent us from throwing away
1550 return tmp; 1529 return tmp;
1551} 1530}
1552 1531
1553/* make_throw_ob() We construct the 'carrier' object in 1532/* make_throw_ob() We construct the 'carrier' object in
1554 * which we will insert the object that is being thrown. 1533 * which we will insert the object that is being thrown.
1555 * This combination becomes the 'thrown object'. -b.t. 1534 * This combination becomes the 'thrown object'. -b.t.
1556 */ 1535 */
1557static object * 1536static object *
1558make_throw_ob (object *orig) 1537make_throw_ob (object *orig)
1559{ 1538{
1560 if (!orig) 1539 if (!orig)
1561 return NULL; 1540 return 0;
1562 1541
1563 if (QUERY_FLAG (orig, FLAG_APPLIED)) 1542 if (QUERY_FLAG (orig, FLAG_APPLIED))
1564 { 1543 {
1565 LOG (llevError, "BUG: make_throw_ob(): ob is applied\n"); 1544 LOG (llevError, "BUG: make_throw_ob(): ob is applied\n");
1566 /* insufficient workaround, but better than nothing */ 1545 /* insufficient workaround, but better than nothing */
1678 */ 1657 */
1679 if (!(throw_ob = throw_ob->split ())) 1658 if (!(throw_ob = throw_ob->split ()))
1680 { 1659 {
1681 throw_ob = left; 1660 throw_ob = left;
1682 left->remove (); 1661 left->remove ();
1683 if (op->type == PLAYER)
1684 esrv_del_item (op->contr, left->count);
1685 }
1686 else if (op->type == PLAYER)
1687 {
1688 if (left->destroyed ())
1689 esrv_del_item (op->contr, left->count);
1690 else
1691 esrv_update_item (UPD_NROF, op, left);
1692 } 1662 }
1693 1663
1694 /* special case: throwing powdery substances like dust, dirt */ 1664 /* special case: throwing powdery substances like dust, dirt */
1695 if (throw_ob->type == POTION && throw_ob->subtype == POT_DUST) 1665 if (throw_ob->type == POTION && throw_ob->subtype == POT_DUST)
1696 { 1666 {
1751 { 1721 {
1752 throw_ob->last_sp += eff_str / 3; /* fly a little further */ 1722 throw_ob->last_sp += eff_str / 3; /* fly a little further */
1753 throw_ob->stats.dam += throw_ob->inv->stats.dam + throw_ob->magic + 2; 1723 throw_ob->stats.dam += throw_ob->inv->stats.dam + throw_ob->magic + 2;
1754 throw_ob->stats.wc -= throw_ob->magic + throw_ob->inv->stats.wc; 1724 throw_ob->stats.wc -= throw_ob->magic + throw_ob->inv->stats.wc;
1755 /* only throw objects get directional faces */ 1725 /* only throw objects get directional faces */
1756 if (GET_ANIM_ID (throw_ob) && NUM_ANIMATIONS (throw_ob)) 1726 if (throw_ob->has_anim () && throw_ob->anim_frames ())
1757 SET_ANIMATION (throw_ob, dir); 1727 throw_ob->set_anim_frame (dir);
1758 } 1728 }
1759 else 1729 else
1760 { 1730 {
1761 uint16 mat = throw_ob->materials; 1731 uint16 mat = throw_ob->materials;
1762 1732

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines