diff -Nurd ./nethack-3.6.1/src/read.c ./gem_v0.1/src/read.c --- ./nethack-3.6.1/src/read.c 2018-04-27 08:07:22.000000000 -0400 +++ ./gem_v0.1/src/read.c 2018-12-26 21:15:11.278715258 -0500 @@ -562,6 +562,87 @@ alter_cost(obj, 0L); } +/* Start of Gem Charging Code */ + + } else if (obj->oclass == GEM_CLASS) { + struct obj *otmp, nothing; + nothing = zeroobj; /* lint suppression; only its address matters */ + static char infuse[24]; + +/*Mapping what we had to what we want instead */ +/*Starting with Gems that have a matching ring */ + if (obj->otyp == RUBY) {Strcpy(infuse, "ruby ring");} + if (obj->otyp == DIAMOND) {Strcpy(infuse, "diamond ring");} + if (obj->otyp == AGATE) {Strcpy(infuse, "agate ring");} + if (obj->otyp == JADE) {Strcpy(infuse, "jade ring");} + if (obj->otyp == EMERALD) {Strcpy(infuse, "emerald ring");} + if (obj->otyp == TOPAZ) {Strcpy(infuse, "topaz ring");} + if (obj->otyp == OPAL) {Strcpy(infuse, "opal ring");} + if (obj->otyp == BLACK_OPAL) {Strcpy(infuse, "opal ring");} + if (obj->otyp == SAPPHIRE) {Strcpy(infuse, "sapphire ring");} +/*Amulets are by shape so in theory are fair game for any of them */ + if (obj->otyp == JACINTH) {Strcpy(infuse, "circular amulet");} + if (obj->otyp == TURQUOISE) {Strcpy(infuse, "spherical amulet");} + if (obj->otyp == CITRINE) {Strcpy(infuse, "oval amulet");} + if (obj->otyp == AQUAMARINE) {Strcpy(infuse, "triangular amulet");} + if (obj->otyp == AMBER) {Strcpy(infuse, "pyramidal amulet");} + if (obj->otyp == GARNET) {Strcpy(infuse, "square amulet");} + if (obj->otyp == AMETHYST) {Strcpy(infuse, "concave amulet");} + if (obj->otyp == JASPER) {Strcpy(infuse, "hexagonal amulet");} + if (obj->otyp == FLUORITE) {Strcpy(infuse, "octagonal amulet");} +/*Overflow into Wands. Dilithium Crystal for teleport. Beam me up Scotty! */ + if (obj->otyp == DILITHIUM_CRYSTAL) {Strcpy(infuse, "wand of teleportation");} + if (obj->otyp == OBSIDIAN) {Strcpy(infuse, "ebony wand");} + if (obj->otyp == CHRYSOBERYL) {Strcpy(infuse, "jeweled wand");} + if (obj->otyp == JET) {Strcpy(infuse, "short wand");} + + + switch (obj->otyp) { /*switch to nuke old object and give user new object only in supported cases*/ + case RUBY: + case DIAMOND: + case AGATE: + case JADE: + case EMERALD: + case TOPAZ: + case OPAL: + case BLACK_OPAL: + case SAPPHIRE: + otmp = readobjnam(infuse, ¬hing); + freeinv(obj); + pline("The gemstone(s) are infused with magic and form into a ring!"); + (void) hold_another_object(otmp, 0, 0, 0); + break; + case JACINTH: + case TURQUOISE: + case CITRINE: + case AQUAMARINE: + case AMBER: + case GARNET: + case AMETHYST: + case JASPER: + case FLUORITE: + otmp = readobjnam(infuse, ¬hing); + freeinv(obj); + pline("The gemstone(s) are infused with magic and form into an amulet!"); + (void) hold_another_object(otmp, 0, 0, 0); + break; + case DILITHIUM_CRYSTAL: + case OBSIDIAN: + case CHRYSOBERYL: + case JET: + otmp = readobjnam(infuse, ¬hing); + freeinv(obj); + pline("The gemstone(s) are infused with magic and form into a wand!"); + (void) hold_another_object(otmp, 0, 0, 0); + break; + default: + pline("You have a feeling of loss"); /*give the tradional behavior if they try on a wrothless piece of glass*/ + break; + } /* switch */ +/* End of Gem Charging Code */ + + + } else if (obj->oclass == TOOL_CLASS) { int rechrg = (int) obj->recharged;