… | |
… | |
569 | perceive_self (object *op) |
569 | perceive_self (object *op) |
570 | { |
570 | { |
571 | const char *cp = describe_item (op, op); |
571 | const char *cp = describe_item (op, op); |
572 | archetype *at = archetype::find (ARCH_DEPLETION); |
572 | archetype *at = archetype::find (ARCH_DEPLETION); |
573 | |
573 | |
574 | dynbuf_text buf; |
574 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
575 | |
575 | |
576 | if (player *pl = op->contr) |
576 | if (!op->is_player ()) |
|
|
577 | return 0; |
|
|
578 | |
577 | if (object *race = archetype::find (op->race)) |
579 | if (object *race = archetype::find (op->race)) |
578 | buf << " - You are a G<male|female> " << &race->name << ".\n"; |
580 | buf << " - You are a G<male|female> " << &race->name << ".\n"; |
579 | |
581 | |
580 | if (object *god = find_god (determine_god (op))) |
582 | if (object *god = find_god (determine_god (op))) |
581 | buf << " - You worship " << &god->name << ".\n"; |
583 | buf << " - You worship " << &god->name << ".\n"; |
582 | else |
584 | else |
583 | buf << " - You worship no god.\n"; |
585 | buf << " - You worship no god.\n"; |
… | |
… | |
609 | |
611 | |
610 | break; |
612 | break; |
611 | } |
613 | } |
612 | } |
614 | } |
613 | |
615 | |
614 | buf << '\0'; // zero-terminate |
616 | op->contr->infobox (MSG_CHANNEL ("perceiveself"), buf); |
615 | |
|
|
616 | new_draw_info (NDI_UNIQUE, 0, op, buf.linearise ()); |
|
|
617 | |
617 | |
618 | return 1; |
618 | return 1; |
619 | } |
619 | } |
620 | |
620 | |
621 | /* This creates magic walls. Really, it can create most any object, |
621 | /* This creates magic walls. Really, it can create most any object, |
… | |
… | |
1463 | |
1463 | |
1464 | /* Identifies objects in the players inventory/on the ground */ |
1464 | /* Identifies objects in the players inventory/on the ground */ |
1465 | int |
1465 | int |
1466 | cast_identify (object *op, object *caster, object *spell) |
1466 | cast_identify (object *op, object *caster, object *spell) |
1467 | { |
1467 | { |
1468 | dynbuf_text buf; |
|
|
1469 | object *tmp; |
1468 | object *tmp; |
|
|
1469 | dynbuf_text &buf = msg_dynbuf; buf.clear (); |
1470 | |
1470 | |
1471 | int num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1471 | int num_ident = max (1, spell->stats.dam + SP_level_dam_adjust (caster, spell)); |
1472 | |
|
|
1473 | if (num_ident < 1) |
|
|
1474 | num_ident = 1; |
|
|
1475 | |
1472 | |
1476 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1473 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1477 | { |
1474 | { |
1478 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1475 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1479 | { |
1476 | { |
… | |
… | |
1485 | |
1482 | |
1486 | if (tmp->msg) |
1483 | if (tmp->msg) |
1487 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1484 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1488 | } |
1485 | } |
1489 | |
1486 | |
1490 | num_ident--; |
|
|
1491 | if (!num_ident) |
1487 | if (!--num_ident) |
1492 | break; |
1488 | break; |
1493 | } |
1489 | } |
1494 | } |
1490 | } |
1495 | |
1491 | |
1496 | /* If all the power of the spell has been used up, don't go and identify |
1492 | /* If all the power of the spell has been used up, don't go and identify |
… | |
… | |
1510 | |
1506 | |
1511 | if (tmp->msg) |
1507 | if (tmp->msg) |
1512 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1508 | buf << "The item has a story:\r" << tmp->msg << "\n\n"; |
1513 | } |
1509 | } |
1514 | |
1510 | |
1515 | num_ident--; |
|
|
1516 | if (!num_ident) |
1511 | if (!--num_ident) |
1517 | break; |
1512 | break; |
1518 | } |
1513 | } |
1519 | } |
1514 | } |
1520 | |
1515 | |
1521 | if (buf.empty ()) |
1516 | if (buf.empty ()) |