MCPcopy Create free account
hub / github.com/NetHack/NetHack / doengrave_sfx_item

Function doengrave_sfx_item

src/engrave.c:741–892  ·  view source on GitHub ↗

special engraving effects for all objects */

Source from the content-addressed store, hash-verified

739
740/* special engraving effects for all objects */
741staticfn boolean
742doengrave_sfx_item(struct _doengrave_ctx *de)
743{
744 switch (de->otmp->oclass) {
745 default:
746 case AMULET_CLASS:
747 case CHAIN_CLASS:
748 case POTION_CLASS:
749 case COIN_CLASS:
750 break;
751 case RING_CLASS:
752 /* "diamond" rings and others should work */
753 case GEM_CLASS:
754 /* diamonds & other hard gems should work */
755 if (objects[de->otmp->otyp].oc_tough) {
756 de->type = ENGRAVE;
757 break;
758 }
759 break;
760 case ARMOR_CLASS:
761 if (is_boots(de->otmp)) {
762 de->type = DUST;
763 break;
764 }
765 FALLTHROUGH;
766 /*FALLTHRU*/
767 /* Objects too large to engrave with */
768 case BALL_CLASS:
769 case ROCK_CLASS:
770 You_cant("engrave with such a large object!");
771 de->ptext = FALSE;
772 break;
773 /* Objects too silly to engrave with */
774 case FOOD_CLASS:
775 case SCROLL_CLASS:
776 case SPBOOK_CLASS:
777 pline("%s would get %s.", Yname2(de->otmp),
778 de->frosted ? "all frosty" : "too dirty");
779 de->ptext = FALSE;
780 break;
781 case RANDOM_CLASS: /* This should mean fingers */
782 break;
783
784 /* The charge is removed from the wand before prompting for
785 * the engraving text, because all kinds of setup decisions
786 * and pre-engraving messages are based upon knowing what type
787 * of engraving the wand is going to do. Also, the player
788 * will have potentially seen "You wrest .." message, and
789 * therefore will know they are using a charge.
790 */
791 case WAND_CLASS:
792 if (zappable(de->otmp)) {
793 check_unpaid(de->otmp);
794 if (de->otmp->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
795 wand_explode(de->otmp, 0);
796 de->ret = ECMD_TIME;
797 return FALSE;
798 }

Callers 1

doengraveFunction · 0.85

Calls 15

You_cantFunction · 0.85
Yname2Function · 0.85
zappableFunction · 0.85
check_unpaidFunction · 0.85
rn2Function · 0.85
wand_explodeFunction · 0.85
can_reach_floorFunction · 0.85
doengrave_sfx_item_WANFunction · 0.85
pline_TheFunction · 0.85
is_artFunction · 0.85
weldedFunction · 0.85
surfaceFunction · 0.85

Tested by

no test coverage detected