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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.187 by elmex, Tue Jan 13 13:29:57 2009 UTC vs.
Revision 1.198 by root, Wed Oct 7 22:18:51 2009 UTC

92 * Return value: 1 if money was destroyed, 0 if not. 92 * Return value: 1 if money was destroyed, 0 if not.
93 */ 93 */
94static int 94static int
95apply_id_altar (object *money, object *altar, object *pl) 95apply_id_altar (object *money, object *altar, object *pl)
96{ 96{
97 dynbuf_text buf; 97 dynbuf_text &buf = msg_dynbuf; buf.clear ();
98 98
99 if (!pl || pl->type != PLAYER) 99 if (!pl || pl->type != PLAYER)
100 return 0; 100 return 0;
101 101
102 /* Check for MONEY type is a special hack - it prevents 'nothing needs 102 /* Check for MONEY type is a special hack - it prevents 'nothing needs
396/**************************************************************************** 396/****************************************************************************
397 * Weapon improvement code follows 397 * Weapon improvement code follows
398 ****************************************************************************/ 398 ****************************************************************************/
399 399
400/** 400/**
401 * This function just checks whether who can handle equipping an item
402 * with item_power.
403 */
404
405bool
406check_item_power (object *who, int item_power)
407{
408 if (who->type == PLAYER
409 && item_power
410 && item_power + who->contr->item_power > settings.item_power_factor * who->level)
411 return false;
412 else
413 return true;
414}
415
416/**
401 * This returns the sum of nrof of item (arch name). 417 * This returns the sum of nrof of item (arch name).
402 */ 418 */
403static int 419static int
404check_item (object *op, shstr_cmp item) 420check_item (object *op, shstr_cmp item)
405{ 421{
450 } 466 }
451 467
452 prev = op; 468 prev = op;
453 op = op->below; 469 op = op->below;
454 } 470 }
455}
456
457/**
458 * This checks to see of the player (who) is sufficient level to use a weapon
459 * with improvs improvements (typically last_eat). We take an int here
460 * instead of the object so that the improvement code can pass along the
461 * increased value to see if the object is usuable.
462 * we return 1 (true) if the player can use the weapon.
463 */
464static int
465check_weapon_power (const object *who, int improvs)
466{
467/* Old code is below (commented out). Basically, since weapons are the only
468 * object players really have any control to improve, it's a bit harsh to
469 * require high level in some combat skill, so we just use overall level.
470 */
471#if 1
472 if (((who->level / 5) + 5) >= improvs)
473 return 1;
474 else
475 return 0;
476
477#else
478 int level = 0;
479
480 /* The skill system hands out wc and dam bonuses to fighters
481 * more generously than the old system (see fix_player). Thus
482 * we need to curtail the power of player enchanted weapons.
483 * I changed this to 1 improvement per "fighter" level/5 -b.t.
484 * Note: Nothing should break by allowing this ratio to be different or
485 * using normal level - it is just a matter of play balance.
486 */
487 if (who->type == PLAYER)
488 {
489 object *wc_obj = NULL;
490
491 for (wc_obj = who->inv; wc_obj; wc_obj = wc_obj->below)
492 if (wc_obj->type == SKILL && IS_COMBAT_SKILL (wc_obj->subtype) && wc_obj->level > level)
493 level = wc_obj->level;
494
495 if (!level)
496 {
497 LOG (llevError, "Error: Player: %s lacks wc experience object\n", who->name);
498 level = who->level;
499 }
500 }
501 else
502 level = who->level;
503
504 return (improvs <= ((level / 5) + 5));
505#endif
506} 471}
507 472
508/** 473/**
509 * Returns how many items of type improver->slaying there are under op. 474 * Returns how many items of type improver->slaying there are under op.
510 * Will display a message if none found, and 1 if improver->slaying is NULL. 475 * Will display a message if none found, and 1 if improver->slaying is NULL.
639 if (improver->stats.sp == IMPROVE_PREPARE) 604 if (improver->stats.sp == IMPROVE_PREPARE)
640 return prepare_weapon (op, improver, weapon); 605 return prepare_weapon (op, improver, weapon);
641 606
642 if (weapon->level == 0) 607 if (weapon->level == 0)
643 { 608 {
644 op->failmsg ("This weapon has not been prepared. H<You first ahve to prepare a weapon with a prepare weapon scroll.>"); 609 op->failmsg (
610 "This weapon has not been prepared."
611 " H<You first have to prepare a weapon with a prepare weapon scroll.>");
645 return 0; 612 return 0;
646 } 613 }
647 614
648 if (weapon->level == weapon->last_eat && weapon->item_power >= 100) 615 if (weapon->last_eat >= weapon->level // improvements used up
616 || weapon->item_power >= 100) // or item_power >= arbitrary limit of 100
649 { 617 {
650 op->failmsg ("This weapon cannot be improved any more."); 618 op->failmsg ("This weapon cannot be improved any more.");
651 return 0; 619 return 0;
652 } 620 }
653 621
654 if (QUERY_FLAG (weapon, FLAG_APPLIED) && !check_weapon_power (op, weapon->last_eat + 1)) 622 if (QUERY_FLAG (weapon, FLAG_APPLIED)
623 && !check_item_power (op, weapon->item_power + 1))
655 { 624 {
656 op->failmsg ("Improving the weapon will make it too " 625 op->failmsg ("Improving the weapon will make it too "
657 "powerful for you to use. Unready it if you " 626 "powerful for you to use. Unready it if you "
658 "really want to improve it."); 627 "really want to improve it.");
659 return 0; 628 return 0;
888 * Takes one type of items and makes another. 857 * Takes one type of items and makes another.
889 * converter is the object that is doing the conversion. 858 * converter is the object that is doing the conversion.
890 * item is the object that triggered the converter - if it is not 859 * item is the object that triggered the converter - if it is not
891 * what the converter wants, this will not do anything. 860 * what the converter wants, this will not do anything.
892 */ 861 */
893static int 862int
894convert_item (object *item, object *converter) 863convert_item (object *item, object *converter)
895{ 864{
896 sint64 nr, price_in; 865 sint64 nr, price_in;
897 866
898 if (item->flag [FLAG_UNPAID]) 867 if (item->flag [FLAG_UNPAID])
1137 1106
1138 SET_FLAG (op, FLAG_NO_APPLY); /* prevent loops */ 1107 SET_FLAG (op, FLAG_NO_APPLY); /* prevent loops */
1139 1108
1140 bool has_unpaid = false; 1109 bool has_unpaid = false;
1141 1110
1142 // quite inefficient to do this here twice, but the api doesn'T lend itself to 1111 // quite inefficient to do this here twice, but the api doesn't lend itself to
1143 // a quick and small change :( 1112 // a quick and small change :(
1144 for (object::depth_iterator item = op->begin (); item != op->end (); ++item) 1113 for (object::depth_iterator item = op->begin (); item != op->end (); ++item)
1145 if (item->flag [FLAG_UNPAID]) 1114 if (item->flag [FLAG_UNPAID])
1146 { 1115 {
1147 has_unpaid = true; 1116 has_unpaid = true;
1372 1341
1373 recursion_depth++; 1342 recursion_depth++;
1374 if (trap->head) 1343 if (trap->head)
1375 trap = trap->head; 1344 trap = trap->head;
1376 1345
1377 if (INVOKE_OBJECT (MOVE_TRIGGER, trap, ARG_OBJECT (victim), ARG_OBJECT (originator))) 1346 if (!INVOKE_OBJECT (MOVE_TRIGGER, trap, ARG_OBJECT (victim), ARG_OBJECT (originator)))
1378 goto leave;
1379
1380 switch (trap->type) 1347 switch (trap->type)
1381 { 1348 {
1382 case PLAYERMOVER: 1349 case PLAYERMOVER:
1383 if (trap->attacktype && (trap->level || victim->type != PLAYER) && !should_director_abort (trap, victim)) 1350 if (trap->attacktype && (trap->level || victim->type != PLAYER) && !should_director_abort (trap, victim))
1351 {
1352 if (!trap->stats.maxsp)
1353 trap->stats.maxsp = 2;
1354
1355 /* Is this correct? From the docs, it doesn't look like it
1356 * should be divided by trap->speed
1357 */
1358 victim->speed_left = -FABS (trap->stats.maxsp * victim->speed / trap->speed);
1359
1360 /* Just put in some sanity check. I think there is a bug in the
1361 * above with some objects have zero speed, and thus the player
1362 * getting permanently paralyzed.
1363 */
1364 if (victim->speed_left < -50.f)
1365 victim->speed_left = -50.f;
1366 /* LOG(llevDebug, "apply, playermove, player speed_left=%f\n", victim->speed_left); */
1367 }
1368 break;
1369
1370 case SPINNER:
1371 if (victim->direction)
1372 {
1373 victim->direction = absdir (victim->direction - trap->stats.sp);
1374 update_turn_face (victim);
1375 }
1376 break;
1377
1378 case DIRECTOR:
1379 if (victim->direction && !should_director_abort (trap, victim))
1380 {
1381 victim->direction = trap->stats.sp;
1382 update_turn_face (victim);
1383 }
1384 break;
1385
1386 case BUTTON:
1387 case PEDESTAL:
1388 update_button (trap, originator);
1389 break;
1390
1391 case ALTAR:
1392 /* sacrifice victim on trap */
1393 apply_altar (trap, victim, originator);
1394 break;
1395
1396 case THROWN_OBJ:
1397 if (trap->inv == NULL)
1398 break;
1399 /* fallthrough */
1400
1401 case ARROW:
1402 /* bad bug: monster throw a object, make a step forwards, step on object ,
1403 * trigger this here and get hit by own missile - and will be own enemy.
1404 * Victim then is his own enemy and will start to kill herself (this is
1405 * removed) but we have not synced victim and his missile. To avoid senseless
1406 * action, we avoid hits here
1407 */
1408 if ((QUERY_FLAG (victim, FLAG_ALIVE) && trap->speed) && trap->owner != victim)
1409 hit_with_arrow (trap, victim);
1410 break;
1411
1412 case SPELL_EFFECT:
1413 apply_spell_effect (trap, victim);
1414 break;
1415
1416 case TRAPDOOR:
1384 { 1417 {
1418 int max, sound_was_played;
1419 object *ab, *ab_next;
1420
1385 if (!trap->stats.maxsp) 1421 if (!trap->value)
1386 trap->stats.maxsp = 2; 1422 {
1423 int tot;
1387 1424
1388 /* Is this correct? From the docs, it doesn't look like it 1425 for (ab = trap->above, tot = 0; ab; ab = ab->above)
1389 * should be divided by trap->speed 1426 if ((ab->move_type && trap->move_on) || ab->move_type == 0)
1427 tot += ab->head_ ()->total_weight ();
1428
1429 if (!(trap->value = (tot > trap->weight) ? 1 : 0))
1430 break;
1431
1432 SET_ANIMATION (trap, trap->value);
1433 update_object (trap, UP_OBJ_FACE);
1434 }
1435
1436 for (ab = trap->above, max = 100, sound_was_played = 0; --max && ab; ab = ab_next)
1437 {
1438 /* need to set this up, since if we do transfer the object,
1439 * ab->above would be bogus
1390 */ 1440 */
1391 victim->speed_left = -FABS (trap->stats.maxsp * victim->speed / trap->speed); 1441 ab_next = ab->above;
1392 1442
1393 /* Just put in some sanity check. I think there is a bug in the 1443 if ((ab->move_type && trap->move_on) || ab->move_type == 0)
1394 * above with some objects have zero speed, and thus the player 1444 {
1395 * getting permanently paralyzed. 1445 if (!sound_was_played)
1446 {
1447 trap->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole"));
1448 sound_was_played = 1;
1449 }
1450
1451 ab->statusmsg ("You fall into a trapdoor!", NDI_RED);
1452 transfer_ob (ab, EXIT_X (trap), EXIT_Y (trap), 0, ab);
1453 }
1396 */ 1454 }
1397 if (victim->speed_left < -50.f) 1455 break;
1398 victim->speed_left = -50.f;
1399 /* LOG(llevDebug, "apply, playermove, player speed_left=%f\n", victim->speed_left); */
1400 } 1456 }
1401 goto leave;
1402 1457
1403 case SPINNER: 1458 case CONVERTER:
1404 if (victim->direction) 1459 if (convert_item (victim, trap) < 0)
1405 {
1406 victim->direction = absdir (victim->direction - trap->stats.sp);
1407 update_turn_face (victim);
1408 }
1409 goto leave;
1410
1411 case DIRECTOR:
1412 if (victim->direction && !should_director_abort (trap, victim))
1413 {
1414 victim->direction = trap->stats.sp;
1415 update_turn_face (victim);
1416 }
1417 goto leave;
1418
1419 case BUTTON:
1420 case PEDESTAL:
1421 update_button (trap, originator);
1422 goto leave;
1423
1424 case ALTAR:
1425 /* sacrifice victim on trap */
1426 apply_altar (trap, victim, originator);
1427 goto leave;
1428
1429 case THROWN_OBJ:
1430 if (trap->inv == NULL)
1431 goto leave;
1432 /* fallthrough */
1433
1434 case ARROW:
1435 /* bad bug: monster throw a object, make a step forwards, step on object ,
1436 * trigger this here and get hit by own missile - and will be own enemy.
1437 * Victim then is his own enemy and will start to kill herself (this is
1438 * removed) but we have not synced victim and his missile. To avoid senseless
1439 * action, we avoid hits here
1440 */
1441 if ((QUERY_FLAG (victim, FLAG_ALIVE) && trap->speed) && trap->owner != victim)
1442 hit_with_arrow (trap, victim);
1443 goto leave;
1444
1445 case SPELL_EFFECT:
1446 apply_spell_effect (trap, victim);
1447 goto leave;
1448
1449 case TRAPDOOR:
1450 {
1451 int max, sound_was_played;
1452 object *ab, *ab_next;
1453
1454 if (!trap->value)
1455 { 1460 {
1456 int tot; 1461 originator->failmsg (format ("The %s seems to be broken!", query_name (trap)));
1457 1462 archetype::get (shstr_burnout)->insert_at (trap, trap);
1458 for (ab = trap->above, tot = 0; ab; ab = ab->above)
1459 if ((ab->move_type && trap->move_on) || ab->move_type == 0)
1460 tot += ab->head_ ()->total_weight ();
1461
1462 if (!(trap->value = (tot > trap->weight) ? 1 : 0))
1463 goto leave;
1464
1465 SET_ANIMATION (trap, trap->value);
1466 update_object (trap, UP_OBJ_FACE);
1467 } 1463 }
1468 1464
1469 for (ab = trap->above, max = 100, sound_was_played = 0; --max && ab; ab = ab_next) 1465 break;
1466
1467 case TRIGGER_BUTTON:
1468 case TRIGGER_PEDESTAL:
1469 case TRIGGER_ALTAR:
1470 check_trigger (trap, victim);
1471 break;
1472
1473 case DEEP_SWAMP:
1474 walk_on_deep_swamp (trap, victim);
1475 break;
1476
1477 case CHECK_INV:
1478 check_inv (victim, trap);
1479 break;
1480
1481 case HOLE:
1482 move_apply_hole (trap, victim);
1483 break;
1484
1485 case EXIT:
1486 if (victim->type == PLAYER && EXIT_PATH (trap))
1470 { 1487 {
1471 /* need to set this up, since if we do transfer the object, 1488 /* Basically, don't show exits leading to random maps the
1472 * ab->above would be bogus 1489 * players output.
1473 */ 1490 */
1474 ab_next = ab->above; 1491 if (trap->msg && !EXIT_PATH (trap).starts_with ("/!"))
1492 victim->statusmsg (trap->msg, NDI_NAVY);
1475 1493
1476 if ((ab->move_type && trap->move_on) || ab->move_type == 0) 1494 trap->play_sound (trap->sound);
1477 { 1495 victim->enter_exit (trap);
1478 if (!sound_was_played)
1479 {
1480 trap->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole"));
1481 sound_was_played = 1;
1482 }
1483
1484 ab->statusmsg ("You fall into a trapdoor!", NDI_RED);
1485 transfer_ob (ab, EXIT_X (trap), EXIT_Y (trap), 0, ab);
1486 }
1487 } 1496 }
1488 goto leave; 1497 break;
1489 }
1490 1498
1491 case CONVERTER:
1492 if (convert_item (victim, trap) < 0)
1493 {
1494 originator->failmsg (format ("The %s seems to be broken!", query_name (trap)));
1495 archetype::get (shstr_burnout)->insert_at (trap, trap);
1496 }
1497
1498 goto leave;
1499
1500 case TRIGGER_BUTTON:
1501 case TRIGGER_PEDESTAL:
1502 case TRIGGER_ALTAR:
1503 check_trigger (trap, victim);
1504 goto leave;
1505
1506 case DEEP_SWAMP:
1507 walk_on_deep_swamp (trap, victim);
1508 goto leave;
1509
1510 case CHECK_INV:
1511 check_inv (victim, trap);
1512 goto leave;
1513
1514 case HOLE:
1515 move_apply_hole (trap, victim);
1516 goto leave;
1517
1518 case EXIT:
1519 if (victim->type == PLAYER && EXIT_PATH (trap))
1520 {
1521 /* Basically, don't show exits leading to random maps the
1522 * players output.
1523 */
1524 if (trap->msg && !EXIT_PATH (trap).starts_with ("/!"))
1525 victim->statusmsg (trap->msg, NDI_NAVY);
1526
1527 trap->play_sound (trap->sound);
1528 victim->enter_exit (trap);
1529 }
1530 goto leave;
1531
1532 case ENCOUNTER: 1499 case ENCOUNTER:
1533 /* may be some leftovers on this */ 1500 /* may be some leftovers on this */
1534 goto leave; 1501 break;
1535 1502
1536 case SHOP_MAT: 1503 case SHOP_MAT:
1537 apply_shop_mat (trap, victim); 1504 apply_shop_mat (trap, victim);
1538 goto leave; 1505 break;
1539 1506
1540 /* Drop a certain amount of gold, and have one item identified */ 1507 /* Drop a certain amount of gold, and have one item identified */
1541 case IDENTIFY_ALTAR: 1508 case IDENTIFY_ALTAR:
1542 apply_id_altar (victim, trap, originator); 1509 apply_id_altar (victim, trap, originator);
1543 goto leave; 1510 break;
1544 1511
1545 case SIGN: 1512 case SIGN:
1546 if (victim->type != PLAYER && trap->stats.food > 0) 1513 if (victim->type != PLAYER && trap->stats.food > 0)
1547 goto leave; /* monsters musn't apply magic_mouths with counters */ 1514 break; /* monsters musn't apply magic_mouths with counters */
1548 1515
1549 apply_sign (victim, trap, 1); 1516 apply_sign (victim, trap, 1);
1550 goto leave; 1517 break;
1551 1518
1552 case CONTAINER: 1519 case CONTAINER:
1553 apply_container (victim, trap); 1520 apply_container (victim, trap);
1554 goto leave; 1521 break;
1555 1522
1556 case RUNE: 1523 case RUNE:
1557 case TRAP: 1524 case TRAP:
1558 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE)) 1525 if (trap->level && QUERY_FLAG (victim, FLAG_ALIVE))
1559 spring_trap (trap, victim); 1526 spring_trap (trap, victim);
1560 goto leave; 1527 break;
1561 1528
1562 default: 1529 default:
1563 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not " 1530 LOG (llevDebug, "name %s, arch %s, type %d with fly/walk on/off not "
1564 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type); 1531 "handled in move_apply()\n", &trap->name, &trap->arch->archname, trap->type);
1565 goto leave; 1532 break;
1566 } 1533 }
1567 1534
1568leave:
1569 recursion_depth--; 1535 recursion_depth--;
1570} 1536}
1571 1537
1572/** 1538/**
1573 * Handles reading a regular (ie not containing a spell) book. 1539 * Handles reading a regular (ie not containing a spell) book.
1776 LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name); 1742 LOG (llevError, "apply_spellbook: Book %s has no spell in it!\n", &tmp->name);
1777 op->failmsg ("The spellbook symbols make no sense. This is a bug, please report!"); 1743 op->failmsg ("The spellbook symbols make no sense. This is a bug, please report!");
1778 return; 1744 return;
1779 } 1745 }
1780 1746
1781 if (skop->level < int (sqrtf (spell->level) * 1.5f)) 1747 int learn_level = sqrtf (spell->level) * 1.5f;
1748 if (skop->level < learn_level)
1782 { 1749 {
1783 op->failmsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low.>", &tmp->skill)); 1750 op->failmsg (format ("You are unable to decipher the strange symbols. H<Your %s level is too low, it must be at least %d.>",
1751 &tmp->skill, learn_level));
1784 return; 1752 return;
1785 } 1753 }
1786 1754
1787 op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name)); 1755 op->statusmsg (format ("The spellbook contains the %s level spell %s.", get_levelnumber (spell->level), &spell->name));
1788 1756
2339/** 2307/**
2340 * This function will try to apply a lighter and in case no lighter 2308 * This function will try to apply a lighter and in case no lighter
2341 * is specified it will try to find a lighter in the players inventory, 2309 * is specified it will try to find a lighter in the players inventory,
2342 * and inform him about this requirement. 2310 * and inform him about this requirement.
2343 * 2311 *
2344 * who - the player 2312 * who - the player
2345 * op - the item we want to light 2313 * op - the item we want to light
2346 * ligher - the lighter or 0 if a lighter has yet to be found 2314 * lighter - the lighter or 0 if a lighter has yet to be found
2347 */ 2315 */
2316static object *
2348object *auto_apply_lighter (object *who, object *op, object *lighter) 2317auto_apply_lighter (object *who, object *op, object *lighter)
2349{ 2318{
2350 if (lighter == 0) 2319 if (lighter == 0)
2351 { 2320 {
2352 for (object *tmp = who->inv; tmp; tmp = tmp->below) 2321 for (object *tmp = who->inv; tmp; tmp = tmp->below)
2353 { 2322 {
2400 int is_player_env = 0; 2369 int is_player_env = 0;
2401 2370
2402 item = find_marked_object (who); 2371 item = find_marked_object (who);
2403 if (item) 2372 if (item)
2404 { 2373 {
2405 if (!auto_apply_lighter (who, 0, lighter)) 2374 if (!auto_apply_lighter (who, item, lighter))
2406 return; 2375 return;
2407 2376
2408 /* Perhaps we should split what we are trying to light on fire? 2377 /* Perhaps we should split what we are trying to light on fire?
2409 * I can't see many times when you would want to light multiple 2378 * I can't see many times when you would want to light multiple
2410 * objects at once. 2379 * objects at once.
2641 case EXIT: 2610 case EXIT:
2642 if (who->type != PLAYER) 2611 if (who->type != PLAYER)
2643 return 0; 2612 return 0;
2644 2613
2645 if (!EXIT_PATH (op) || !is_legal_2ways_exit (who, op)) 2614 if (!EXIT_PATH (op) || !is_legal_2ways_exit (who, op))
2646 who->failmsg (format ("The %s is closed.", query_name (op))); 2615 who->failmsg (format ("The %s is closed. H<And will stay closed, until somebody fires up the map editor and adds it.>", query_name (op)));
2647 else 2616 else
2648 { 2617 {
2649 /* Don't display messages for random maps. */ 2618 /* Don't display messages for random maps. */
2650 if (op->msg && !EXIT_PATH (op).starts_with ("/!")) 2619 if (op->msg && !EXIT_PATH (op).starts_with ("/!"))
2651 who->statusmsg (op->msg, NDI_NAVY); 2620 who->statusmsg (op->msg, NDI_NAVY);
3390 * skill so that the dam and wc get updated 3359 * skill so that the dam and wc get updated
3391 */ 3360 */
3392 who->change_skill (skop); 3361 who->change_skill (skop);
3393 } 3362 }
3394 3363
3395 if (who->type == PLAYER 3364 if (!check_item_power (who, op->item_power))
3396 && op->item_power
3397 && op->item_power + who->contr->item_power > settings.item_power_factor * who->level)
3398 { 3365 {
3399 who->failmsg ("Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER); 3366 who->failmsg ("Equipping that combined with other items would consume your soul!" LACK_ITEM_POWER);
3400 return 1; 3367 return 1;
3401 } 3368 }
3402 3369
3410 return RESULT_INT (0); 3377 return RESULT_INT (0);
3411 3378
3412 switch (op->type) 3379 switch (op->type)
3413 { 3380 {
3414 case WEAPON: 3381 case WEAPON:
3415 if (!check_weapon_power (who, op->last_eat))
3416 {
3417 op->failmsg ("This weapon is too powerful for you to use. It would consume your soul!" LACK_ITEM_POWER);
3418
3419 if (tmp)
3420 insert_ob_in_ob (tmp, who);
3421
3422 return 1;
3423 }
3424
3425 //TODO: this obviously fails for players using a shorter prefix 3382 //TODO: this obviously fails for players using a shorter prefix
3426 // i.e. "R" can use Ragnarok's sword. 3383 // i.e. "R" can use Ragnarok's sword.
3427 if (op->level && !op->name.starts_with (who->name)) 3384 if (op->level && !op->name.starts_with (who->name))
3428 { 3385 {
3429 /* if the weapon does not have the name as the character, can't use it. */ 3386 /* if the weapon does not have the name as the character, can't use it. */
3555 } 3512 }
3556 3513
3557 break; 3514 break;
3558 3515
3559 case BOW: 3516 case BOW:
3560 if (!check_weapon_power (who, op->last_eat))
3561 {
3562 who->failmsg ("That weapon is too powerful for you to use. It would consume your soul!" LACK_ITEM_POWER);
3563
3564 if (tmp)
3565 insert_ob_in_ob (tmp, who);
3566
3567 return 1;
3568 }
3569
3570 if (op->level && !op->name.starts_with (who->name)) 3517 if (op->level && !op->name.starts_with (who->name))
3571 { 3518 {
3572 who->failmsg ("The weapon does not recognize you as its owner. " 3519 who->failmsg ("The weapon does not recognize you as its owner. "
3573 "H<Its name indicates that it belongs to somebody else.>"); 3520 "H<Its name indicates that it belongs to somebody else.>");
3574 if (tmp) 3521 if (tmp)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines