… | |
… | |
1463 | |
1463 | |
1464 | return success; |
1464 | return success; |
1465 | } |
1465 | } |
1466 | |
1466 | |
1467 | /* Identifies objects in the players inventory/on the ground */ |
1467 | /* Identifies objects in the players inventory/on the ground */ |
1468 | |
|
|
1469 | int |
1468 | int |
1470 | cast_identify (object *op, object *caster, object *spell) |
1469 | cast_identify (object *op, object *caster, object *spell) |
1471 | { |
1470 | { |
|
|
1471 | dynbuf_text buf; |
1472 | object *tmp; |
1472 | object *tmp; |
1473 | int success = 0, num_ident; |
|
|
1474 | |
1473 | |
1475 | num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1474 | int num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1476 | |
1475 | |
1477 | if (num_ident < 1) |
1476 | if (num_ident < 1) |
1478 | num_ident = 1; |
1477 | num_ident = 1; |
1479 | |
1478 | |
1480 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1479 | for (tmp = op->inv; tmp; tmp = tmp->below) |
… | |
… | |
1483 | { |
1482 | { |
1484 | identify (tmp); |
1483 | identify (tmp); |
1485 | |
1484 | |
1486 | if (op->type == PLAYER) |
1485 | if (op->type == PLAYER) |
1487 | { |
1486 | { |
1488 | new_draw_info_format (NDI_UNIQUE, 0, op, "You identified: %s.", long_desc (tmp, op)); |
1487 | buf.printf ("You identified: %s.\n\n", long_desc (tmp, op)); |
1489 | |
1488 | |
1490 | if (tmp->msg) |
1489 | if (tmp->msg) |
1491 | { |
1490 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1492 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1493 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1494 | } |
|
|
1495 | } |
1491 | } |
1496 | |
1492 | |
1497 | num_ident--; |
1493 | num_ident--; |
1498 | success = 1; |
|
|
1499 | if (!num_ident) |
1494 | if (!num_ident) |
1500 | break; |
1495 | break; |
1501 | } |
1496 | } |
1502 | } |
1497 | } |
1503 | |
1498 | |
… | |
… | |
1512 | { |
1507 | { |
1513 | identify (tmp); |
1508 | identify (tmp); |
1514 | |
1509 | |
1515 | if (op->type == PLAYER) |
1510 | if (op->type == PLAYER) |
1516 | { |
1511 | { |
1517 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground you identified: %s.", long_desc (tmp, op)); |
1512 | buf.printf ("On the ground you identified: %s.\n\n", long_desc (tmp, op)); |
1518 | |
1513 | |
1519 | if (tmp->msg) |
1514 | if (tmp->msg) |
1520 | { |
1515 | buf << "The item has a story:\n\n" << tmp->msg << "\n\n"; |
1521 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
|
|
1522 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
|
|
1523 | } |
|
|
1524 | |
1516 | |
1525 | esrv_send_item (op, tmp); |
1517 | esrv_send_item (op, tmp); |
1526 | } |
1518 | } |
1527 | |
1519 | |
1528 | num_ident--; |
1520 | num_ident--; |
1529 | success = 1; |
|
|
1530 | if (!num_ident) |
1521 | if (!num_ident) |
1531 | break; |
1522 | break; |
1532 | } |
1523 | } |
1533 | } |
1524 | } |
1534 | |
1525 | |
1535 | if (!success) |
1526 | if (buf.empty ()) |
1536 | new_draw_info (NDI_UNIQUE, 0, op, "You can't reach anything unidentified."); |
1527 | { |
|
|
1528 | op->failmsg ("You can't reach anything unidentified."); |
|
|
1529 | return 0; |
|
|
1530 | } |
1537 | else |
1531 | else |
|
|
1532 | { |
|
|
1533 | if (op->contr) |
|
|
1534 | op->contr->infobox (MSG_CHANNEL ("identify"), buf); |
|
|
1535 | |
1538 | spell_effect (spell, op->x, op->y, op->map, op); |
1536 | spell_effect (spell, op->x, op->y, op->map, op); |
1539 | |
1537 | return 1; |
1540 | return success; |
1538 | } |
1541 | } |
1539 | } |
1542 | |
1540 | |
1543 | int |
1541 | int |
1544 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1542 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1545 | { |
1543 | { |