Skip to content

Commit

Permalink
Overhaul of ring appearances and materials.
Browse files Browse the repository at this point in the history
This fixes issue #504 - rings could not have their material manipulated by the scroll of transmogrify. This required a complete reset of the ring appearances and the appearances have been decoupled from the materials. The main problem was that many of the ring appearances *were* materials, and changing the actual material would result in paradoxial situations (ex: you might try to change a silver ring to a gold ring, but a gold ring already exists.

I also updated the display of rings so their material always shows in front of the appearance or ring type, and the scroll of transmogrify can be used to change a ring to a random material now.

Thanks to hothraxxa for mentioning how the previous behavior could result in a vampiric player getting the unfortunate silver ring of slow digestion - at least now the material can be changed!
  • Loading branch information
elunna committed Oct 15, 2023
1 parent a0b414d commit 4b69075
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 76 deletions.
21 changes: 21 additions & 0 deletions src/mkobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -3558,6 +3558,25 @@ static const struct icp shiny_materials[] = {
{ 2, PLATINUM}
};

/* Reflectable items - for the shield of reflection; anything
that can hold a polish. Amulets also arbitrarily use this list */
static const struct icp ring_materials[] = {
{ 10, 0}, /* use base material */
{ 5, BONE},
{ 10, COPPER},
{ 10, GEMSTONE},
{ 5, GLASS},
{ 5, GOLD},
{ 10, IRON},
{ 10, METAL},
{ 10, MINERAL},
{ 5, MITHRIL},
{ 5, PLASTIC},
{ 5, PLATINUM},
{ 5, SILVER},
{ 5, WOOD}
};

/* for bells and other tools, especially instruments, which are normally copper
* or metal. Wood and glass in other lists precludes us from using those */
static const struct icp resonant_materials[] = {
Expand Down Expand Up @@ -3785,6 +3804,8 @@ struct obj* obj;

/* Otherwise, select an appropriate list, or return NULL if no appropriate
* list exists. */
if (obj->oclass == RING_CLASS)
return ring_materials;
if (is_elven_obj(obj) && default_material != CLOTH)
return elven_materials;
else if (is_dwarvish_obj(obj) && default_material != CLOTH)
Expand Down
76 changes: 38 additions & 38 deletions src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,37 +710,37 @@ BOOTS("levitation boots", "snow boots",
BITS(0, 0, spec, 0, mgc, spec, 0, 0, 0, \
HARDGEM(mohs), 0, P_NONE, metal), \
power, RING_CLASS, prob, 0, 3, cost, 0, 0, 0, 0, 15, color)
RING("adornment", "wooden", ADORNED, 100, 1, 1, 1, 2, WOOD, HI_WOOD),
RING("gain constitution", "opal", 0, 150, 1, 1, 1, 7, MINERAL, HI_MINERAL),
RING("gain strength", "granite", 0, 150, 1, 1, 1, 7, MINERAL, HI_MINERAL),
RING("increase accuracy", "clay", 0, 150, 1, 1, 1, 4, MINERAL, CLR_RED),
RING("increase damage", "coral", 0, 150, 1, 1, 1, 4, MINERAL, CLR_ORANGE),
RING("protection", "black onyx", PROTECTION, 100, 1, 1, 1, 7, MINERAL, CLR_BLACK),
RING("adornment", "spiral", ADORNED, 100, 1, 1, 1, 2, WOOD, HI_WOOD),
RING("gain constitution", "puzzle", 0, 150, 1, 1, 1, 7, MINERAL, HI_MINERAL),
RING("gain strength", "pyramid", 0, 150, 1, 1, 1, 7, MINERAL, HI_MINERAL),
RING("increase accuracy", "rhombus", 0, 150, 1, 1, 1, 4, MINERAL, CLR_RED),
RING("increase damage", "teardrop", 0, 150, 1, 1, 1, 4, MINERAL, CLR_ORANGE),
RING("protection", "knotted", PROTECTION, 100, 1, 1, 1, 7, MINERAL, CLR_BLACK),
/* 'PROTECTION' intrinsic enhances MC from worn armor by +1,
regardless of ring's enchantment; wearing a second ring of
protection (or even one ring of protection combined with
cloak of protection) doesn't give a second MC boost */
RING("carrying", "glittery", 0, 200, 1, 1, 1, 7, GEMSTONE, CLR_WHITE),
RING("regeneration", "moonstone", REGENERATION, 200, 1, 1, 0, 6, MINERAL, HI_MINERAL),
RING("searching", "tiger eye", SEARCHING, 200, 1, 1, 0, 6, GEMSTONE, CLR_BROWN),
RING("stealth", "jade", STEALTH, 100, 1, 1, 0, 6, GEMSTONE, CLR_GREEN),
RING("sustain ability", "bronze", FIXED_ABIL, 100, 1, 1, 0, 4, COPPER, HI_COPPER),
RING("levitation", "agate", LEVITATION, 200, 1, 1, 0, 7, GEMSTONE, CLR_RED),
RING("hunger", "topaz", HUNGER, 100, 1, 1, 0, 8, GEMSTONE, CLR_CYAN),
RING("aggravate monster", "sapphire", AGGRAVATE_MONSTER, 150, 1, 1, 0, 9, GEMSTONE, CLR_BLUE),
RING("conflict", "ruby", CONFLICT, 300, 1, 1, 0, 9, GEMSTONE, CLR_RED),
RING("warning", "diamond", WARNING, 100, 1, 1, 0, 10, GEMSTONE, CLR_WHITE),
RING("poison resistance", "pearl", POISON_RES, 150, 1, 1, 0, 4, BONE, CLR_WHITE),
RING("fire resistance", "iron", FIRE_RES, 200, 1, 1, 0, 5, IRON, HI_METAL),
RING("cold resistance", "brass", COLD_RES, 150, 1, 1, 0, 4, COPPER, HI_COPPER),
RING("regeneration", "mobius", REGENERATION, 200, 1, 1, 0, 6, MINERAL, HI_MINERAL),
RING("searching", "infinity", SEARCHING, 200, 1, 1, 0, 6, GEMSTONE, CLR_BROWN),
RING("stealth", "viney", STEALTH, 100, 1, 1, 0, 6, GEMSTONE, CLR_GREEN),
RING("sustain ability", "braided", FIXED_ABIL, 100, 1, 1, 0, 4, COPPER, HI_COPPER),
RING("levitation", "antique", LEVITATION, 200, 1, 1, 0, 7, GEMSTONE, CLR_RED),
RING("hunger", "scaled", HUNGER, 100, 1, 1, 0, 8, GEMSTONE, CLR_CYAN),
RING("aggravate monster", "crescent", AGGRAVATE_MONSTER, 150, 1, 1, 0, 9, GEMSTONE, CLR_BLUE),
RING("conflict", "chunky", CONFLICT, 300, 1, 1, 0, 9, GEMSTONE, CLR_RED),
RING("warning", "tribal", WARNING, 100, 1, 1, 0, 10, GEMSTONE, CLR_WHITE),
RING("poison resistance", "rustic", POISON_RES, 150, 1, 1, 0, 4, BONE, CLR_WHITE),
RING("fire resistance", "retro", FIRE_RES, 200, 1, 1, 0, 5, IRON, HI_METAL),
RING("cold resistance", "exotic", COLD_RES, 150, 1, 1, 0, 4, COPPER, HI_COPPER),
RING("sonic resistance", "embossed", SONIC_RES, 150, 1, 1, 0, 3, GLASS, HI_GLASS), /* SpliceHack */
RING("shock resistance", "copper", SHOCK_RES, 150, 1, 1, 0, 3, COPPER, HI_COPPER),
RING("shock resistance", "floral", SHOCK_RES, 150, 1, 1, 0, 3, COPPER, HI_COPPER),
RING("free action", "twisted", FREE_ACTION, 200, 1, 1, 0, 6, METAL, HI_METAL),
RING("slow digestion", "steel", SLOW_DIGESTION, 200, 1, 1, 0, 8, METAL, HI_METAL),
RING("teleportation", "silver", TELEPORT, 200, 1, 1, 0, 3, SILVER, HI_SILVER),
RING("teleport control", "gold", TELEPORT_CONTROL, 300, 1, 1, 0, 3, GOLD, HI_GOLD),
RING("polymorph", "ivory", POLYMORPH, 300, 1, 1, 0, 4, BONE, CLR_WHITE),
RING("polymorph control", "emerald", POLYMORPH_CONTROL, 300, 1, 1, 0, 8, GEMSTONE, CLR_BRIGHT_GREEN),
RING("slow digestion", "bohemian", SLOW_DIGESTION, 200, 1, 1, 0, 8, METAL, HI_METAL),
RING("teleportation", "vintage", TELEPORT, 200, 1, 1, 0, 3, SILVER, HI_SILVER),
RING("teleport control", "cosmic", TELEPORT_CONTROL, 300, 1, 1, 0, 3, GOLD, HI_GOLD),
RING("polymorph", "star", POLYMORPH, 300, 1, 1, 0, 4, BONE, CLR_WHITE),
RING("polymorph control", "round", POLYMORPH_CONTROL, 300, 1, 1, 0, 8, GEMSTONE, CLR_BRIGHT_GREEN),
RING("invisibility", "wire", INVIS, 150, 1, 1, 0, 5, METAL, HI_METAL),
RING("see invisible", "engagement", SEE_INVIS, 150, 1, 1, 0, 5, GOLD, HI_METAL),
RING("mood", "ridged", 0, 100, 1, 1, 0, 8, IRON, HI_METAL), /* Slash'EM */
Expand All @@ -749,21 +749,21 @@ RING("displacement", "neon", DISPLACED, 200,
RING("protection from shape changers", "shiny", PROT_FROM_SHAPE_CHANGERS, 100, 1, 1, 0, 5, PLATINUM, CLR_BRIGHT_CYAN),

/* Extra descriptions */
RING(None, "quartz", 0, 150, 0, 0, 0, 7, GLASS, HI_GLASS),
RING(None, "porcelain", 0, 150, 0, 0, 0, 8, GLASS, HI_MINERAL),
RING(None, "ceramic", 0, 150, 0, 0, 0, 8, GLASS, HI_MINERAL),
RING(None, "mithril", 0, 150, 0, 0, 0, 5, MITHRIL, HI_SILVER),
RING(None, "platinum", 0, 150, 0, 0, 0, 3, PLATINUM, HI_METAL),
RING(None, "jacinth", 0, 150, 0, 0, 0, 9, GEMSTONE, CLR_ORANGE),
RING(None, "citrine", 0, 150, 0, 0, 0, 6, GEMSTONE, CLR_ORANGE),
RING(None, "amber", 0, 150, 0, 0, 0, 2, GEMSTONE, CLR_BROWN),
RING(None, "jet", 0, 150, 0, 0, 0, 7, GEMSTONE, CLR_BLACK),
RING(None, "chrysoberyl", 0, 150, 0, 0, 0, 5, GEMSTONE, CLR_YELLOW),
RING(None, "obsidian", 0, 150, 0, 0, 0, 7, GEMSTONE, CLR_BLACK),
RING(None, "cubic", 0, 150, 0, 0, 0, 7, GLASS, HI_GLASS),
RING(None, "angular", 0, 150, 0, 0, 0, 8, GLASS, HI_MINERAL),
RING(None, "zodiac", 0, 150, 0, 0, 0, 8, GLASS, HI_MINERAL),
RING(None, "dainty", 0, 150, 0, 0, 0, 5, MITHRIL, HI_SILVER),
RING(None, "tri-band", 0, 150, 0, 0, 0, 3, PLATINUM, HI_METAL),
RING(None, "bezeled", 0, 150, 0, 0, 0, 9, GEMSTONE, CLR_ORANGE),
RING(None, "clustered", 0, 150, 0, 0, 0, 6, GEMSTONE, CLR_ORANGE),
RING(None, "abstract", 0, 150, 0, 0, 0, 2, GEMSTONE, CLR_BROWN),
RING(None, "ancient", 0, 150, 0, 0, 0, 7, GEMSTONE, CLR_BLACK),
RING(None, "gothic", 0, 150, 0, 0, 0, 5, GEMSTONE, CLR_YELLOW),
RING(None, "celtic", 0, 150, 0, 0, 0, 7, GEMSTONE, CLR_BLACK),
RING(None, "plain", 0, 150, 0, 0, 0, 7, MINERAL, HI_MINERAL),
RING(None, "glass", 0, 150, 0, 0, 0, 7, GLASS, CLR_CYAN),
RING(None, "crystal", 0, 150, 0, 0, 0, 5, GLASS, HI_GLASS), /* SpliceHack */
RING(None, "plastic", 0, 150, 0, 0, 0, 1, PLASTIC, CLR_WHITE),
RING(None, "wavey", 0, 150, 0, 0, 0, 7, GLASS, CLR_CYAN),
RING(None, "roman", 0, 150, 0, 0, 0, 5, GLASS, HI_GLASS), /* SpliceHack */
RING(None, "tapered", 0, 150, 0, 0, 0, 1, PLASTIC, CLR_WHITE),

#undef RING

Expand Down
5 changes: 5 additions & 0 deletions src/objnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ struct obj *obj;
|| (typ) == JACKET \
|| (typ) == PLAIN_CLOAK \
|| (typ) == STAKE \
|| ((typ) >= RIN_ADORNMENT && (typ) <= RIN_PROTECTION_FROM_SHAPE_CHAN) \
|| ((typ) == GLOVES && objects[GLOVES].oc_name_known) \
|| ((typ) == GAUNTLETS && objects[GAUNTLETS].oc_name_known))

Expand Down Expand Up @@ -1114,6 +1115,10 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
Sprintf(eos(buf), "%s spellbook", dn);
break;
case RING_CLASS:
if (dknown) {
Strcat(buf, materialnm[obj->material]);
Strcat(buf, " ");
}
if (!dknown)
Strcpy(buf, "ring");
else if (nn) {
Expand Down
Loading

0 comments on commit 4b69075

Please sign in to comment.