… | |
… | |
71 | static char numbers_10[10][20] = { |
71 | static char numbers_10[10][20] = { |
72 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
72 | "zero", "ten", "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", |
73 | "eighty", "ninety" |
73 | "eighty", "ninety" |
74 | }; |
74 | }; |
75 | |
75 | |
76 | static char levelnumbers[21][20] = { |
76 | static char ordnumbers[21][20] = { |
77 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
77 | "zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", |
78 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
78 | "eighth", "ninth", "tenth", "eleventh", "twelfth", "thirteenth", |
79 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteen", |
79 | "fourteenth", "fifteenth", "sixteenth", "seventeenth", "eighteenth", |
80 | "nineteen", "twentieth" |
80 | "nineteenth", "twentieth" |
81 | }; |
81 | }; |
82 | |
82 | |
83 | static char levelnumbers_10[11][20] = { |
83 | static char ordnumbers_10[11][20] = { |
84 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
84 | "zeroth", "tenth", "twentieth", "thirtieth", "fortieth", "fiftieth", "sixtieth", |
85 | "seventieth", "eightieth", "ninetieth" |
85 | "seventieth", "eightieth", "ninetieth" |
86 | }; |
86 | }; |
87 | |
87 | |
88 | /* The following is a large table of item types, the fields are: |
88 | /* The following is a large table of item types, the fields are: |
… | |
… | |
151 | {EXIT, "exit", "exits", 0, 0}, |
151 | {EXIT, "exit", "exits", 0, 0}, |
152 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
152 | {ENCOUNTER, "encounter", "encounters", 0, 0}, |
153 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
153 | {SHOP_FLOOR, "shop floor", "shop floors", 0, 0}, |
154 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
154 | {SHOP_MAT, "shop mat", "shop mats", 0, 0}, |
155 | {RING, "ring", "rings", SK_JEWELER, 0}, |
155 | {RING, "ring", "rings", SK_JEWELER, 0}, |
156 | {FLOOR, "floor", "floors", 0, 0}, |
156 | // {FLOOR, "floor", "floors", 0, 0}, |
157 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
157 | {FLESH, "flesh", "flesh", SK_WOODSMAN, 0}, |
158 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
158 | {INORGANIC, "inorganic", "inorganics", SK_ALCHEMY, 0}, |
159 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
159 | {SKILL_TOOL, "skill tool", "skill tools", 0, 0}, |
160 | {LIGHTER, "lighter", "lighters", 0, 0}, |
160 | {LIGHTER, "lighter", "lighters", 0, 0}, |
161 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
161 | {BUILDABLE_WALL, "buildable wall", "buildable walls", 0, 0}, |
… | |
… | |
387 | /* |
387 | /* |
388 | * Returns the pointer to a static buffer containing |
388 | * Returns the pointer to a static buffer containing |
389 | * the number requested (of the form first, second, third...) |
389 | * the number requested (of the form first, second, third...) |
390 | */ |
390 | */ |
391 | const char * |
391 | const char * |
392 | get_levelnumber (int i) |
392 | ordinal (int i) |
393 | { |
393 | { |
394 | static char buf[MAX_BUF]; |
394 | if (i < 0) |
395 | |
395 | return format ("minus %s", ordinal (-i)); |
396 | if (i > 99) |
|
|
397 | { |
|
|
398 | sprintf (buf, "%d.", i); |
|
|
399 | return buf; |
|
|
400 | } |
|
|
401 | |
396 | |
402 | if (i < 21) |
397 | if (i < 21) |
403 | return levelnumbers[i]; |
398 | return ordnumbers[i]; |
404 | |
399 | |
|
|
400 | int digit = i % 10; |
|
|
401 | |
405 | if (!(i % 10)) |
402 | if (i >= 100) |
|
|
403 | return format ( |
|
|
404 | digit == 1 ? "%dst" |
|
|
405 | : digit == 2 ? "%dnd" |
|
|
406 | : digit == 3 ? "%drd" |
|
|
407 | : "%dth", |
|
|
408 | i |
|
|
409 | ); |
|
|
410 | |
|
|
411 | if (digit == 0) |
406 | return levelnumbers_10[i / 10]; |
412 | return ordnumbers_10[i / 10]; |
407 | |
413 | else |
408 | strcpy (buf, numbers_10[i / 10]); |
414 | return format ("%s%s", numbers_10[i / 10], ordnumbers[i % 10]); |
409 | strcat (buf, levelnumbers[i % 10]); |
|
|
410 | return buf; |
|
|
411 | } |
415 | } |
412 | |
416 | |
413 | /* |
417 | /* |
414 | * Returns pointer to static buffer containing ring's or amulet's |
418 | * Returns pointer to static buffer containing ring's or amulet's |
415 | * abilities |
419 | * abilities |
… | |
… | |
427 | ring_desc (const object *op) |
431 | ring_desc (const object *op) |
428 | { |
432 | { |
429 | static dynbuf_text buf; buf.clear (); |
433 | static dynbuf_text buf; buf.clear (); |
430 | int attr, val, len; |
434 | int attr, val, len; |
431 | |
435 | |
432 | if (QUERY_FLAG (op, FLAG_IDENTIFIED)) |
436 | if (op->flag [FLAG_IDENTIFIED]) |
433 | { |
437 | { |
434 | for (attr = 0; attr < NUM_STATS; attr++) |
438 | for (attr = 0; attr < NUM_STATS; attr++) |
435 | if ((val = op->stats.stat (attr))) |
439 | if ((val = op->stats.stat (attr))) |
436 | buf.printf ("(%s%+d)", short_stat_name[attr], val); |
440 | buf.printf ("(%s%+d)", short_stat_name[attr], val); |
437 | |
441 | |
… | |
… | |
446 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
450 | if (op->stats.grace) buf.printf ("(grace%+d)", op->stats.grace); |
447 | if (op->stats.sp && op->type != SKILL) buf.printf ("(magic%+d)", op->stats.sp); |
451 | if (op->stats.sp && op->type != SKILL) buf.printf ("(magic%+d)", op->stats.sp); |
448 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
452 | if (op->stats.hp) buf.printf ("(regeneration%+d)", op->stats.hp); |
449 | if (op->stats.luck) buf.printf ("(luck%+d)", op->stats.luck); |
453 | if (op->stats.luck) buf.printf ("(luck%+d)", op->stats.luck); |
450 | |
454 | |
451 | if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)"; |
455 | if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)"; |
452 | if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)"; |
456 | if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)"; |
453 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)"; |
457 | if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)"; |
454 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)"; |
458 | if (op->flag [FLAG_STEALTH]) buf << "(stealth)"; |
455 | |
459 | |
456 | buf.add_paths ("Attuned" , op->path_attuned); |
460 | buf.add_paths ("Attuned" , op->path_attuned); |
457 | buf.add_paths ("Repelled", op->path_repelled); |
461 | buf.add_paths ("Repelled", op->path_repelled); |
458 | buf.add_paths ("Denied" , op->path_denied); |
462 | buf.add_paths ("Denied" , op->path_denied); |
459 | |
463 | |
… | |
… | |
485 | |
489 | |
486 | static dynbuf_text buf; buf.clear (); |
490 | static dynbuf_text buf; buf.clear (); |
487 | |
491 | |
488 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
492 | buf << (op->nrof <= 1 ? op->name : op->name_pl); |
489 | |
493 | |
490 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
494 | if (op->title && op->flag [FLAG_IDENTIFIED]) |
491 | buf << ' ' << op->title; |
495 | buf << ' ' << op->title; |
492 | |
496 | |
493 | switch (op->type) |
497 | switch (op->type) |
494 | { |
498 | { |
495 | case SPELLBOOK: |
499 | case SPELLBOOK: |
496 | case SCROLL: |
500 | case SCROLL: |
497 | case WAND: |
501 | case WAND: |
498 | case ROD: |
502 | case ROD: |
499 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
503 | if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED]) |
500 | { |
504 | { |
501 | if (!op->title) |
505 | if (!op->title) |
502 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
506 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
503 | |
507 | |
504 | if (op->type != SPELLBOOK) |
508 | if (op->type != SPELLBOOK) |
… | |
… | |
543 | buf << " " << s; |
547 | buf << " " << s; |
544 | } |
548 | } |
545 | break; |
549 | break; |
546 | |
550 | |
547 | default: |
551 | default: |
548 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
552 | if (op->magic && ((op->flag [FLAG_BEEN_APPLIED] && need_identify (op)) || op->flag [FLAG_IDENTIFIED])) |
549 | buf.printf (" %+d", op->magic); |
553 | buf.printf (" %+d", op->magic); |
550 | } |
554 | } |
551 | |
555 | |
552 | return buf; |
556 | return buf; |
553 | } |
557 | } |
… | |
… | |
584 | buf << op->material->description << ' '; |
588 | buf << op->material->description << ' '; |
585 | #endif |
589 | #endif |
586 | |
590 | |
587 | buf << query_short_name (op); |
591 | buf << query_short_name (op); |
588 | |
592 | |
589 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
593 | if (op->flag [FLAG_INV_LOCKED]) |
590 | buf << " *"; |
594 | buf << " *"; |
591 | if (op->is_open_container ()) |
595 | if (op->is_open_container ()) |
592 | buf << " (open)"; |
596 | buf << " (open)"; |
593 | |
597 | |
594 | if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) |
598 | if (op->flag [FLAG_KNOWN_CURSED]) |
595 | { |
599 | { |
596 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
600 | if (op->flag [FLAG_DAMNED]) |
597 | buf << " (damned)"; |
601 | buf << " (damned)"; |
598 | else if (QUERY_FLAG (op, FLAG_CURSED)) |
602 | else if (op->flag [FLAG_CURSED]) |
599 | buf << " (cursed)"; |
603 | buf << " (cursed)"; |
600 | } |
604 | } |
601 | |
605 | |
602 | /* Basically, if the object is known magical (detect magic spell on it), |
606 | /* Basically, if the object is known magical (detect magic spell on it), |
603 | * and it isn't identified, print out the fact that |
607 | * and it isn't identified, print out the fact that |
… | |
… | |
606 | * |
610 | * |
607 | * Changed in V 0.91.4 - still print that the object is magical even |
611 | * Changed in V 0.91.4 - still print that the object is magical even |
608 | * if it has been applied. Equipping an item does not tell full |
612 | * if it has been applied. Equipping an item does not tell full |
609 | * abilities, especially for artifact items. |
613 | * abilities, especially for artifact items. |
610 | */ |
614 | */ |
611 | if (QUERY_FLAG (op, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (op, FLAG_IDENTIFIED)) |
615 | if (op->flag [FLAG_KNOWN_MAGICAL] && !op->flag [FLAG_IDENTIFIED]) |
612 | buf << " (magic)"; |
616 | buf << " (magic)"; |
613 | |
617 | |
614 | #if 0 |
618 | #if 0 |
615 | /* item_power will be returned in describe_item - it shouldn't really |
619 | /* item_power will be returned in describe_item - it shouldn't really |
616 | * be returned in the name. |
620 | * be returned in the name. |
… | |
… | |
618 | if (op->item_power) |
622 | if (op->item_power) |
619 | sprintf (buf[use_buf] + strlen (buf[use_buf]), "(item_power %+d)", op->item_power); |
623 | sprintf (buf[use_buf] + strlen (buf[use_buf]), "(item_power %+d)", op->item_power); |
620 | |
624 | |
621 | #endif |
625 | #endif |
622 | |
626 | |
623 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
627 | if (op->flag [FLAG_APPLIED]) |
624 | { |
628 | { |
625 | switch (op->type) |
629 | switch (op->type) |
626 | { |
630 | { |
627 | case BOW: |
631 | case BOW: |
628 | case WAND: |
632 | case WAND: |
… | |
… | |
671 | else if (op->stats.food <= 0) |
675 | else if (op->stats.food <= 0) |
672 | buf << " (burned out)"; |
676 | buf << " (burned out)"; |
673 | break; |
677 | break; |
674 | } |
678 | } |
675 | |
679 | |
676 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
680 | if (op->flag [FLAG_UNPAID]) |
677 | buf << " (unpaid)"; |
681 | buf << " (unpaid)"; |
678 | |
682 | |
679 | return buf; |
683 | return buf; |
680 | } |
684 | } |
681 | |
685 | |
… | |
… | |
710 | buf << op->material->description << ' '; |
714 | buf << op->material->description << ' '; |
711 | #endif |
715 | #endif |
712 | |
716 | |
713 | buf << (plural ? op->name_pl : op->name); |
717 | buf << (plural ? op->name_pl : op->name); |
714 | |
718 | |
715 | if (op->title && QUERY_FLAG (op, FLAG_IDENTIFIED)) |
719 | if (op->title && op->flag [FLAG_IDENTIFIED]) |
716 | buf << ' ' << op->title; |
720 | buf << ' ' << op->title; |
717 | |
721 | |
718 | switch (op->type) |
722 | switch (op->type) |
719 | { |
723 | { |
720 | case SPELLBOOK: |
724 | case SPELLBOOK: |
721 | case SCROLL: |
725 | case SCROLL: |
722 | case WAND: |
726 | case WAND: |
723 | case ROD: |
727 | case ROD: |
724 | if (QUERY_FLAG (op, FLAG_IDENTIFIED) || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
728 | if (op->flag [FLAG_IDENTIFIED] || op->flag [FLAG_BEEN_APPLIED]) |
725 | { |
729 | { |
726 | if (!op->title) |
730 | if (!op->title) |
727 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
731 | buf << " of " << (op->inv ? &op->inv->name : "bug, please report"); |
728 | |
732 | |
729 | if (op->type != SPELLBOOK) |
733 | if (op->type != SPELLBOOK) |
… | |
… | |
752 | else if (!EXIT_PATH (op)) |
756 | else if (!EXIT_PATH (op)) |
753 | buf << " (closed)"; |
757 | buf << " (closed)"; |
754 | break; |
758 | break; |
755 | |
759 | |
756 | default: |
760 | default: |
757 | if (op->magic && ((QUERY_FLAG (op, FLAG_BEEN_APPLIED) && need_identify (op)) || QUERY_FLAG (op, FLAG_IDENTIFIED))) |
761 | if (op->magic && ((op->flag [FLAG_BEEN_APPLIED] && need_identify (op)) || op->flag [FLAG_IDENTIFIED])) |
758 | buf.printf (" %+d", op->magic); |
762 | buf.printf (" %+d", op->magic); |
759 | } |
763 | } |
760 | |
764 | |
761 | return buf; |
765 | return buf; |
762 | } |
766 | } |
… | |
… | |
805 | default: |
809 | default: |
806 | buf << "(lightning fast movement)"; |
810 | buf << "(lightning fast movement)"; |
807 | break; |
811 | break; |
808 | } |
812 | } |
809 | |
813 | |
810 | if (QUERY_FLAG (op, FLAG_UNDEAD)) buf << "(undead)"; |
814 | if (op->flag [FLAG_UNDEAD]) buf << "(undead)"; |
811 | if (QUERY_FLAG (op, FLAG_SEE_INVISIBLE)) buf << "(see invisible)"; |
815 | if (op->flag [FLAG_SEE_INVISIBLE]) buf << "(see invisible)"; |
812 | if (QUERY_FLAG (op, FLAG_USE_WEAPON)) buf << "(wield weapon)"; |
816 | if (op->flag [FLAG_USE_WEAPON]) buf << "(wield weapon)"; |
813 | if (QUERY_FLAG (op, FLAG_USE_BOW)) buf << "(archer)"; |
817 | if (op->flag [FLAG_USE_BOW]) buf << "(archer)"; |
814 | if (QUERY_FLAG (op, FLAG_USE_ARMOUR)) buf << "(wear armour)"; |
818 | if (op->flag [FLAG_USE_ARMOUR]) buf << "(wear armour)"; |
815 | if (QUERY_FLAG (op, FLAG_USE_RING)) buf << "(wear ring)"; |
819 | if (op->flag [FLAG_USE_RING]) buf << "(wear ring)"; |
816 | if (QUERY_FLAG (op, FLAG_USE_SCROLL)) buf << "(read scroll)"; |
820 | if (op->flag [FLAG_USE_SCROLL]) buf << "(read scroll)"; |
817 | if (QUERY_FLAG (op, FLAG_USE_RANGE)) buf << "(fires wand/rod/horn)"; |
821 | if (op->flag [FLAG_USE_RANGE]) buf << "(fires wand/rod/horn)"; |
818 | if (QUERY_FLAG (op, FLAG_CAN_USE_SKILL)) buf << "(skill user)"; |
822 | if (op->flag [FLAG_CAN_USE_SKILL]) buf << "(skill user)"; |
819 | if (QUERY_FLAG (op, FLAG_CAST_SPELL)) buf << "(spellcaster)"; |
823 | if (op->flag [FLAG_CAST_SPELL]) buf << "(spellcaster)"; |
820 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) buf << "(friendly)"; |
824 | if (op->flag [FLAG_FRIENDLY]) buf << "(friendly)"; |
821 | if (QUERY_FLAG (op, FLAG_UNAGGRESSIVE)) buf << "(unaggressive)"; |
825 | if (op->flag [FLAG_UNAGGRESSIVE]) buf << "(unaggressive)"; |
822 | if (QUERY_FLAG (op, FLAG_HITBACK)) buf << "(hitback)"; |
826 | if (op->flag [FLAG_HITBACK]) buf << "(hitback)"; |
823 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealthy)"; |
827 | if (op->flag [FLAG_STEALTH]) buf << "(stealthy)"; |
824 | |
828 | |
825 | if (op->randomitems) |
829 | if (op->randomitems) |
826 | { |
830 | { |
827 | bool first = 1; |
831 | bool first = 1; |
828 | |
832 | |
… | |
… | |
910 | * item (eg, debug dump or the like) |
914 | * item (eg, debug dump or the like) |
911 | */ |
915 | */ |
912 | const char * |
916 | const char * |
913 | describe_item (const object *op, object *owner) |
917 | describe_item (const object *op, object *owner) |
914 | { |
918 | { |
915 | if (QUERY_FLAG (op, FLAG_MONSTER) || op->type == PLAYER) |
919 | if (op->flag [FLAG_MONSTER] || op->type == PLAYER) |
916 | return describe_monster (op); |
920 | return describe_monster (op); |
917 | |
921 | |
918 | static dynbuf_text buf; buf.clear (); |
922 | static dynbuf_text buf; buf.clear (); |
919 | int identified, i; |
923 | int identified, i; |
920 | |
924 | |
921 | /* figure this out once, instead of making multiple calls to need_identify. |
925 | /* figure this out once, instead of making multiple calls to need_identify. |
922 | * also makes the code easier to read. |
926 | * also makes the code easier to read. |
923 | */ |
927 | */ |
924 | identified = !need_identify (op) || QUERY_FLAG (op, FLAG_IDENTIFIED); |
928 | identified = !need_identify (op) || op->flag [FLAG_IDENTIFIED]; |
925 | if (!identified) |
929 | if (!identified) |
926 | buf << "(unidentified)"; |
930 | buf << "(unidentified)"; |
927 | |
931 | |
928 | switch (op->type) |
932 | switch (op->type) |
929 | { |
933 | { |
… | |
… | |
999 | break; |
1003 | break; |
1000 | |
1004 | |
1001 | case FOOD: |
1005 | case FOOD: |
1002 | case FLESH: |
1006 | case FLESH: |
1003 | case DRINK: |
1007 | case DRINK: |
1004 | if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
1008 | if (identified || op->flag [FLAG_BEEN_APPLIED]) |
1005 | { |
1009 | { |
1006 | buf.printf ("(food+%d)", op->stats.food); |
1010 | buf.printf ("(food+%d)", op->stats.food); |
1007 | |
1011 | |
1008 | if (op->type == FLESH && op->last_eat > 0 && atnr_is_dragon_enabled (op->last_eat)) |
1012 | if (op->type == FLESH && op->last_eat > 0 && atnr_is_dragon_enabled (op->last_eat)) |
1009 | buf.printf ("(%s metabolism)", change_resist_msg[op->last_eat]); |
1013 | buf.printf ("(%s metabolism)", change_resist_msg[op->last_eat]); |
1010 | |
1014 | |
1011 | if (!QUERY_FLAG (op, FLAG_CURSED)) |
1015 | if (!op->flag [FLAG_CURSED]) |
1012 | { |
1016 | { |
1013 | if (op->stats.hp) buf << "(heals)"; |
1017 | if (op->stats.hp) buf << "(heals)"; |
1014 | if (op->stats.sp) buf << "(spellpoint regen)"; |
1018 | if (op->stats.sp) buf << "(spellpoint regen)"; |
1015 | } |
1019 | } |
1016 | else |
1020 | else |
… | |
… | |
1037 | } |
1041 | } |
1038 | |
1042 | |
1039 | /* Down here, we more further describe equipment type items. |
1043 | /* Down here, we more further describe equipment type items. |
1040 | * only describe them if they have been identified or the like. |
1044 | * only describe them if they have been identified or the like. |
1041 | */ |
1045 | */ |
1042 | if (identified || QUERY_FLAG (op, FLAG_BEEN_APPLIED)) |
1046 | if (identified || op->flag [FLAG_BEEN_APPLIED]) |
1043 | { |
1047 | { |
1044 | int attr, val; |
1048 | int attr, val; |
1045 | |
1049 | |
1046 | for (attr = 0; attr < NUM_STATS; attr++) |
1050 | for (attr = 0; attr < NUM_STATS; attr++) |
1047 | if ((val = op->stats.stat (attr))) |
1051 | if ((val = op->stats.stat (attr))) |
… | |
… | |
1078 | |
1082 | |
1079 | default: |
1083 | default: |
1080 | break; |
1084 | break; |
1081 | } |
1085 | } |
1082 | |
1086 | |
1083 | if (QUERY_FLAG (op, FLAG_XRAYS)) buf << "(xray-vision)"; |
1087 | if (op->flag [FLAG_XRAYS]) buf << "(xray-vision)"; |
1084 | if (QUERY_FLAG (op, FLAG_SEE_IN_DARK)) buf << "(infravision)"; |
1088 | if (op->flag [FLAG_SEE_IN_DARK]) buf << "(infravision)"; |
1085 | |
1089 | |
1086 | /* levitate was what is was before, so we'll keep it */ |
1090 | /* levitate was what is was before, so we'll keep it */ |
1087 | if (op->move_type & MOVE_FLY_LOW) buf << "(levitate)"; |
1091 | if (op->move_type & MOVE_FLY_LOW) buf << "(levitate)"; |
1088 | if (op->move_type & MOVE_FLY_HIGH) buf << "(fly)"; |
1092 | if (op->move_type & MOVE_FLY_HIGH) buf << "(fly)"; |
1089 | if (op->move_type & MOVE_SWIM) buf << "(swim)"; |
1093 | if (op->move_type & MOVE_SWIM) buf << "(swim)"; |
… | |
… | |
1151 | } |
1155 | } |
1152 | |
1156 | |
1153 | if (op->stats.luck) |
1157 | if (op->stats.luck) |
1154 | buf.printf ("(luck%+d)", op->stats.luck); |
1158 | buf.printf ("(luck%+d)", op->stats.luck); |
1155 | |
1159 | |
1156 | if (QUERY_FLAG (op, FLAG_LIFESAVE)) buf << "(lifesaving)"; |
1160 | if (op->flag [FLAG_LIFESAVE]) buf << "(lifesaving)"; |
1157 | if (QUERY_FLAG (op, FLAG_REFL_SPELL)) buf << "(reflect spells)"; |
1161 | if (op->flag [FLAG_REFL_SPELL]) buf << "(reflect spells)"; |
1158 | if (QUERY_FLAG (op, FLAG_REFL_MISSILE)) buf << "(reflect missiles)"; |
1162 | if (op->flag [FLAG_REFL_MISSILE]) buf << "(reflect missiles)"; |
1159 | if (QUERY_FLAG (op, FLAG_STEALTH)) buf << "(stealth)"; |
1163 | if (op->flag [FLAG_STEALTH]) buf << "(stealth)"; |
1160 | |
1164 | |
1161 | if (op->slaying && op->type != FOOD) |
1165 | if (op->slaying && op->type != FOOD) |
1162 | buf.printf ("(slay %s)", &op->slaying); |
1166 | buf.printf ("(slay %s)", &op->slaying); |
1163 | |
1167 | |
1164 | if (op->type == SKILL_TOOL && op->skill) |
1168 | if (op->type == SKILL_TOOL && op->skill) |
… | |
… | |
1208 | |
1212 | |
1209 | switch (type) |
1213 | switch (type) |
1210 | { |
1214 | { |
1211 | case SPELLBOOK: |
1215 | case SPELLBOOK: |
1212 | if (flag [FLAG_IDENTIFIED] && inv) |
1216 | if (flag [FLAG_IDENTIFIED] && inv) |
1213 | buf.printf ("%s is a level %s %s spell.\r", &inv->name, get_levelnumber (inv->level), &inv->skill); |
1217 | buf.printf ("%s is a %s level %s spell.\r", &inv->name, ordinal (inv->level), &inv->skill); |
1214 | break; |
1218 | break; |
1215 | |
1219 | |
1216 | case BOOK: |
1220 | case BOOK: |
1217 | if (msg) |
1221 | if (msg) |
1218 | buf << "Something is written in it.\r"; |
1222 | buf << "Something is written in it.\r"; |
… | |
… | |
1374 | object::query_inventory (object *who, const char *indent) |
1378 | object::query_inventory (object *who, const char *indent) |
1375 | { |
1379 | { |
1376 | static dynbuf_text buf; buf.clear (); |
1380 | static dynbuf_text buf; buf.clear (); |
1377 | |
1381 | |
1378 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1382 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1379 | if (who && QUERY_FLAG (who, FLAG_WIZ)) |
1383 | if (who && who->flag [FLAG_WIZ]) |
1380 | buf.printf ("%s- %-28.28s %-8s (%9d) %s\n", indent, tmp->query_name (), tmp->query_weight (), tmp->count, tmp->uuid.c_str ()); |
1384 | buf.printf ("%s- %-28.28s %-8s (%9d) %s\n", indent, tmp->query_name (), tmp->query_weight (), tmp->count, tmp->uuid.c_str ()); |
1381 | else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) |
1385 | else if (!tmp->invisible && (type == CONTAINER || tmp->flag [FLAG_APPLIED])) |
1382 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1386 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1383 | |
1387 | |
1384 | if (buf.size ()) |
1388 | if (buf.size ()) |
1385 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |
1389 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |
1386 | else |
1390 | else |
… | |
… | |
1399 | is_magical (const object *op) |
1403 | is_magical (const object *op) |
1400 | { |
1404 | { |
1401 | int i; |
1405 | int i; |
1402 | |
1406 | |
1403 | /* living creatures are considered non magical */ |
1407 | /* living creatures are considered non magical */ |
1404 | if (QUERY_FLAG (op, FLAG_ALIVE)) |
1408 | if (op->flag [FLAG_ALIVE]) |
1405 | return 0; |
1409 | return 0; |
1406 | |
1410 | |
1407 | /* This is a test for it being an artifact, as artifacts have titles */ |
1411 | /* This is a test for it being an artifact, as artifacts have titles */ |
1408 | if (op->title != NULL) |
1412 | if (op->title != NULL) |
1409 | return 1; |
1413 | return 1; |
… | |
… | |
1415 | (op->stats.ac || op->stats.food || op->stats.exp || op->stats.dam || op->stats.wc || op->stats.sp || op->stats.hp || op->stats.luck)) |
1419 | (op->stats.ac || op->stats.food || op->stats.exp || op->stats.dam || op->stats.wc || op->stats.sp || op->stats.hp || op->stats.luck)) |
1416 | return 1; |
1420 | return 1; |
1417 | |
1421 | |
1418 | /* Check for stealty, speed, flying, or just plain magic in the boots */ |
1422 | /* Check for stealty, speed, flying, or just plain magic in the boots */ |
1419 | /* Presume any boots that hvae a move_type are special. */ |
1423 | /* Presume any boots that hvae a move_type are special. */ |
1420 | if (op->type == BOOTS && ((QUERY_FLAG (op, FLAG_STEALTH) || op->move_type || op->stats.exp))) |
1424 | if (op->type == BOOTS && ((op->flag [FLAG_STEALTH] || op->move_type || op->stats.exp))) |
1421 | return 1; |
1425 | return 1; |
1422 | |
1426 | |
1423 | /* Take care of amulet/shield that reflects spells/missiles */ |
1427 | /* Take care of amulet/shield that reflects spells/missiles */ |
1424 | if ((op->type == AMULET || op->type == SHIELD) && (QUERY_FLAG (op, FLAG_REFL_SPELL) || QUERY_FLAG (op, FLAG_REFL_MISSILE))) |
1428 | if ((op->type == AMULET || op->type == SHIELD) && (op->flag [FLAG_REFL_SPELL] || op->flag [FLAG_REFL_MISSILE])) |
1425 | return 1; |
1429 | return 1; |
1426 | |
1430 | |
1427 | /* Take care of helmet of xrays */ |
1431 | /* Take care of helmet of xrays */ |
1428 | if (op->type == HELMET && QUERY_FLAG (op, FLAG_XRAYS)) |
1432 | if (op->type == HELMET && op->flag [FLAG_XRAYS]) |
1429 | return 1; |
1433 | return 1; |
1430 | |
1434 | |
1431 | /* Potions & rods are always magical. Wands/staves are also magical, |
1435 | /* Potions & rods are always magical. Wands/staves are also magical, |
1432 | * assuming they still have any charges left. |
1436 | * assuming they still have any charges left. |
1433 | */ |
1437 | */ |
… | |
… | |
1522 | * Supposed to fix face-values as well here, but later. |
1526 | * Supposed to fix face-values as well here, but later. |
1523 | */ |
1527 | */ |
1524 | void |
1528 | void |
1525 | identify (object *op) |
1529 | identify (object *op) |
1526 | { |
1530 | { |
1527 | SET_FLAG (op, FLAG_IDENTIFIED); |
1531 | op->set_flag (FLAG_IDENTIFIED); |
1528 | CLEAR_FLAG (op, FLAG_KNOWN_MAGICAL); |
1532 | op->clr_flag (FLAG_KNOWN_MAGICAL); |
1529 | CLEAR_FLAG (op, FLAG_NO_SKILL_IDENT); |
1533 | op->clr_flag (FLAG_NO_SKILL_IDENT); |
1530 | |
1534 | |
1531 | /* |
1535 | /* |
1532 | * We want autojoining of equal objects: |
1536 | * We want autojoining of equal objects: |
1533 | */ |
1537 | */ |
1534 | if (QUERY_FLAG (op, FLAG_CURSED) || QUERY_FLAG (op, FLAG_DAMNED)) |
1538 | if (op->flag [FLAG_CURSED] || op->flag [FLAG_DAMNED]) |
1535 | SET_FLAG (op, FLAG_KNOWN_CURSED); |
1539 | op->set_flag (FLAG_KNOWN_CURSED); |
1536 | |
1540 | |
1537 | if (op->type == POTION) |
1541 | if (op->type == POTION) |
1538 | { |
1542 | { |
1539 | if (op->inv && op->randomitems) |
1543 | if (op->inv && op->randomitems) |
1540 | op->title = op->inv->name; |
1544 | op->title = op->inv->name; |