… | |
… | |
272 | { |
272 | { |
273 | int i, tmp, enc; |
273 | int i, tmp, enc; |
274 | |
274 | |
275 | enc = 0; |
275 | enc = 0; |
276 | for (i = 0; i < NUM_STATS; i++) |
276 | for (i = 0; i < NUM_STATS; i++) |
277 | enc += get_attr_value (&op->stats, i); |
277 | enc += op->stats.stat (i); |
278 | |
278 | |
279 | /* This protection logic is pretty flawed. 20% fire resistance |
279 | /* This protection logic is pretty flawed. 20% fire resistance |
280 | * is much more valuable than 20% confusion, or 20% slow, or |
280 | * is much more valuable than 20% confusion, or 20% slow, or |
281 | * several others. Start at 1 - ignore physical - all that normal |
281 | * several others. Start at 1 - ignore physical - all that normal |
282 | * armour shouldn't be counted against |
282 | * armour shouldn't be counted against |
… | |
… | |
502 | if (!QUERY_FLAG (op, FLAG_IDENTIFIED)) |
502 | if (!QUERY_FLAG (op, FLAG_IDENTIFIED)) |
503 | return buf; |
503 | return buf; |
504 | |
504 | |
505 | for (attr = 0; attr < NUM_STATS; attr++) |
505 | for (attr = 0; attr < NUM_STATS; attr++) |
506 | { |
506 | { |
507 | if ((val = get_attr_value (&(op->stats), attr)) != 0) |
507 | if ((val = op->stats.stat (attr))) |
508 | { |
|
|
509 | sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); |
508 | sprintf (buf + strlen (buf), "(%s%+d)", short_stat_name[attr], val); |
510 | } |
|
|
511 | } |
509 | } |
512 | |
510 | |
513 | if (op->stats.exp) |
511 | if (op->stats.exp) |
514 | sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); |
512 | sprintf (buf + strlen (buf), "(speed %+lld)", (long long) op->stats.exp); |
515 | if (op->stats.wc) |
513 | if (op->stats.wc) |
… | |
… | |
1084 | break; /* We have more information to do below this switch */ |
1082 | break; /* We have more information to do below this switch */ |
1085 | |
1083 | |
1086 | case POWER_CRYSTAL: |
1084 | case POWER_CRYSTAL: |
1087 | if (op->stats.maxsp > 1000) |
1085 | if (op->stats.maxsp > 1000) |
1088 | { /*higher capacity crystals */ |
1086 | { /*higher capacity crystals */ |
1089 | i = (op->stats.maxsp % 100) / 10; |
1087 | i = (op->stats.maxsp % 1000) / 100; |
|
|
1088 | |
1090 | if (i) |
1089 | if (i) |
1091 | snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 100, i); |
1090 | snprintf (buf, MAX_BUF, "(capacity %d.%dk). It is ", op->stats.maxsp / 1000, i); |
1092 | else |
1091 | else |
1093 | snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 100); |
1092 | snprintf (buf, MAX_BUF, "(capacity %dk). It is ", op->stats.maxsp / 1000); |
1094 | } |
1093 | } |
1095 | else |
1094 | else |
1096 | snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); |
1095 | snprintf (buf, MAX_BUF, "(capacity %d). It is ", op->stats.maxsp); |
|
|
1096 | |
1097 | strcat (retbuf, buf); |
1097 | strcat (retbuf, buf); |
1098 | i = (op->stats.sp * 10) / op->stats.maxsp; |
1098 | i = (op->stats.sp * 10) / op->stats.maxsp; |
1099 | if (op->stats.sp == 0) |
1099 | if (op->stats.sp == 0) |
1100 | strcat (retbuf, "empty."); |
1100 | strcat (retbuf, "empty."); |
1101 | else if (i == 0) |
1101 | else if (i == 0) |
… | |
… | |
1166 | { |
1166 | { |
1167 | int attr, val; |
1167 | int attr, val; |
1168 | |
1168 | |
1169 | for (attr = 0; attr < NUM_STATS; attr++) |
1169 | for (attr = 0; attr < NUM_STATS; attr++) |
1170 | { |
1170 | { |
1171 | if ((val = get_attr_value (&(op->stats), attr)) != 0) |
1171 | if ((val = op->stats.stat (attr))) |
1172 | { |
1172 | { |
1173 | sprintf (buf, "(%s%+d)", short_stat_name[attr], val); |
1173 | sprintf (buf, "(%s%+d)", short_stat_name[attr], val); |
1174 | strcat (retbuf, buf); |
1174 | strcat (retbuf, buf); |
1175 | } |
1175 | } |
1176 | } |
1176 | } |
… | |
… | |
1433 | if (op->magic || op->type == POWER_CRYSTAL || op->type == SPELLBOOK || op->type == SCROLL || op->type == GIRDLE) |
1433 | if (op->magic || op->type == POWER_CRYSTAL || op->type == SPELLBOOK || op->type == SCROLL || op->type == GIRDLE) |
1434 | return 1; |
1434 | return 1; |
1435 | |
1435 | |
1436 | /* Check to see if it increases/decreases any stats */ |
1436 | /* Check to see if it increases/decreases any stats */ |
1437 | for (i = 0; i < NUM_STATS; i++) |
1437 | for (i = 0; i < NUM_STATS; i++) |
1438 | if (get_attr_value (&(op->stats), i) != 0) |
1438 | if (op->stats.stat (i)) |
1439 | return 1; |
1439 | return 1; |
1440 | |
1440 | |
1441 | /* If it doesn't fall into any of the above categories, must |
1441 | /* If it doesn't fall into any of the above categories, must |
1442 | * be non magical. |
1442 | * be non magical. |
1443 | */ |
1443 | */ |
… | |
… | |
1452 | int |
1452 | int |
1453 | need_identify (const object *op) |
1453 | need_identify (const object *op) |
1454 | { |
1454 | { |
1455 | switch (op->type) |
1455 | switch (op->type) |
1456 | { |
1456 | { |
1457 | case RING: |
1457 | case RING: |
1458 | case WAND: |
1458 | case WAND: |
1459 | case ROD: |
1459 | case ROD: |
1460 | case HORN: |
1460 | case HORN: |
1461 | case SCROLL: |
1461 | case SCROLL: |
1462 | case SKILL: |
1462 | case SKILL: |
1463 | case SKILLSCROLL: |
1463 | case SKILLSCROLL: |
1464 | case SPELLBOOK: |
1464 | case SPELLBOOK: |
1465 | case FOOD: |
1465 | case FOOD: |
1466 | case POTION: |
1466 | case POTION: |
1467 | case BOW: |
1467 | case BOW: |
1468 | case ARROW: |
1468 | case ARROW: |
1469 | case WEAPON: |
1469 | case WEAPON: |
1470 | case ARMOUR: |
1470 | case ARMOUR: |
1471 | case SHIELD: |
1471 | case SHIELD: |
1472 | case HELMET: |
1472 | case HELMET: |
1473 | case AMULET: |
1473 | case AMULET: |
1474 | case BOOTS: |
1474 | case BOOTS: |
1475 | case GLOVES: |
1475 | case GLOVES: |
1476 | case BRACERS: |
1476 | case BRACERS: |
1477 | case GIRDLE: |
1477 | case GIRDLE: |
1478 | case CONTAINER: |
1478 | case CONTAINER: |
1479 | case DRINK: |
1479 | case DRINK: |
1480 | case FLESH: |
1480 | case FLESH: |
1481 | case INORGANIC: |
1481 | case INORGANIC: |
1482 | case CLOSE_CON: |
1482 | case CLOSE_CON: |
1483 | case CLOAK: |
1483 | case CLOAK: |
1484 | case GEM: |
1484 | case GEM: |
1485 | case POWER_CRYSTAL: |
1485 | case POWER_CRYSTAL: |
1486 | case POISON: |
1486 | case POISON: |
1487 | case BOOK: |
1487 | case BOOK: |
1488 | case SKILL_TOOL: |
1488 | case SKILL_TOOL: |
1489 | return 1; |
1489 | return 1; |
1490 | } |
1490 | } |
|
|
1491 | |
1491 | /* Try to track down some stuff that may show up here. Thus, the |
1492 | /* Try to track down some stuff that may show up here. Thus, the |
1492 | * archetype file can be updated, and this function removed. |
1493 | * archetype file can be updated, and this function removed. |
1493 | */ |
1494 | */ |
1494 | #if 0 |
1495 | #if 0 |
1495 | LOG (llevDebug, "need_identify: %s does not need to be id'd\n", op->name); |
1496 | LOG (llevDebug, "need_identify: %s does not need to be id'd\n", op->name); |