touchstone again
Recent patches broke rubbing gold coins on touchstones; for the
!GOLDOBJ configuration, the character's money would be lost and the
program leaked memory. That problem was already present for rubbing
gold on other gray stones.
This also gives a gem advantage back to archeologists: they
can comprehend touchstone results when the stone is uncursed rather
than require it to be blessed. (I gave gnome characters that benefit
too. Why gnomes and not dwarves? I don't have a reasonable answer
for that....) To go along with that, make A's initial touchstone
start uncursed rather than blessed, so that other characters finding
them in bones won't get an immediate benefit from them for the 20%
of the time that they're not cursed when saving bones.
Much of this is whitespace cleanup. I reformatted use_stone()
completely.
This commit is contained in:
+71
-66
@@ -1821,36 +1821,47 @@ reset_trapset()
|
||||
|
||||
/* touchstones - by Ken Arnold */
|
||||
STATIC_OVL void
|
||||
use_stone(otmp)
|
||||
struct obj *otmp;
|
||||
use_stone(tstone)
|
||||
struct obj *tstone;
|
||||
{
|
||||
struct obj *obj;
|
||||
char allowall[3];
|
||||
const char *color = 0;
|
||||
static const char *ambiguous_scratch = "You make scratch marks on the stone.";
|
||||
const char *scritch = "\"scritch, scritch\"";
|
||||
unsigned material;
|
||||
const char *streak_color = 0;
|
||||
static const char scritch[] = "\"scritch, scritch\"",
|
||||
ambiguous_scratch[] = "You make scratch marks on the stone.";
|
||||
static char allowall[3] = { GOLD_CLASS, ALL_CLASSES, 0 };
|
||||
#ifndef GOLDOBJ
|
||||
struct obj goldobj;
|
||||
#endif
|
||||
|
||||
allowall[0] = GOLD_CLASS;
|
||||
allowall[1] = ALL_CLASSES;
|
||||
allowall[2] = '\0';
|
||||
if (!(obj = getobj(allowall, "rub on the stone")))
|
||||
if ((obj = getobj(allowall, "rub on the stone")) == 0)
|
||||
return;
|
||||
#ifndef GOLDOBJ
|
||||
if (obj->oclass == GOLD_CLASS) {
|
||||
u.ugold += obj->quan; /* keep botl up to date */
|
||||
goldobj = *obj;
|
||||
dealloc_obj(obj);
|
||||
obj = &goldobj;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (otmp == obj) {
|
||||
if (obj == tstone) {
|
||||
You_cant("rub %s on itself.", the(xname(obj)));
|
||||
return;
|
||||
}
|
||||
material = objects[obj->otyp].oc_material;
|
||||
|
||||
if (otmp->cursed &&
|
||||
obj->oclass == GEM_CLASS && !is_graystone(obj) && !rn2(5)) {
|
||||
pline(
|
||||
(Blind ? "You feel something shatter." :
|
||||
(Hallucination ? "Oh, wow, look at the pretty shards." :
|
||||
"A sharp crack shatters %s %s.")),
|
||||
(obj->quan == 1 ? "the" : "a"),
|
||||
lcase(makesingular(let_to_name(obj->oclass, FALSE))));
|
||||
if (tstone->cursed &&
|
||||
obj->oclass == GEM_CLASS && !is_graystone(obj) &&
|
||||
!obj_resists(obj, 80, 100)) {
|
||||
if (Blind)
|
||||
pline("You feel something shatter.");
|
||||
else if (Hallucination)
|
||||
pline("Oh, wow, look at the pretty shards.");
|
||||
else
|
||||
pline("A sharp crack shatters %s%s.",
|
||||
(obj->quan > 1) ? "one of " : "", the(xname(obj)));
|
||||
#ifndef GOLDOBJ
|
||||
/* assert(obj != &goldobj); */
|
||||
#endif
|
||||
useup(obj);
|
||||
return;
|
||||
}
|
||||
@@ -1858,69 +1869,62 @@ struct obj *otmp;
|
||||
if (Blind) {
|
||||
pline(scritch);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Hallucination) {
|
||||
} else if (Hallucination) {
|
||||
pline("Oh wow, man: Fractals!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (material == LIQUID || material == WAX ||
|
||||
material == CLOTH || material == WOOD || material == GOLD) {
|
||||
switch(material) {
|
||||
case LIQUID:
|
||||
if (!obj->known)
|
||||
You("must think this is a wetstone, do you?");
|
||||
else
|
||||
pline("%s a little wetter now.", Tobjnam(otmp, "are"));
|
||||
break;
|
||||
case WAX:
|
||||
color = "waxy";
|
||||
goto see_streaks; /* okay even if not touchstone */
|
||||
/*NOTREACHED*/
|
||||
switch (obj->oclass) {
|
||||
case GEM_CLASS: /* these have class-specific handling below */
|
||||
case RING_CLASS:
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (objects[obj->otyp].oc_material) {
|
||||
case CLOTH:
|
||||
pline_The("stone looks a little more polished now.");
|
||||
break;
|
||||
case WOOD:
|
||||
color = "wooden";
|
||||
goto see_streaks; /* okay even if not touchstone */
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
}
|
||||
return;
|
||||
case LIQUID:
|
||||
if (!obj->known) /* note: not "whetstone" */
|
||||
You("must think this is a wetstone, do you?");
|
||||
else
|
||||
pline("%s a little wetter now.", Tobjnam(tstone, "are"));
|
||||
return;
|
||||
case WAX:
|
||||
streak_color = "waxy";
|
||||
goto see_streaks; /* okay even if not touchstone */
|
||||
case WOOD:
|
||||
streak_color = "wooden";
|
||||
goto see_streaks; /* okay even if not touchstone */
|
||||
case GOLD:
|
||||
streak_color = "golden";
|
||||
goto see_streaks;
|
||||
case SILVER:
|
||||
streak_color = "silvery";
|
||||
goto see_streaks;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break; /* default oclass */
|
||||
}
|
||||
|
||||
if (is_flimsy(obj)) {
|
||||
/* Objects passing the is_flimsy() test will not
|
||||
scratch a stone. They will leave streaks on
|
||||
non-touchstones and touchstones alike */
|
||||
color = c_obj_colors[objects[obj->otyp].oc_color];
|
||||
non-touchstones and touchstones alike. */
|
||||
streak_color = c_obj_colors[objects[obj->otyp].oc_color];
|
||||
goto see_streaks;
|
||||
}
|
||||
|
||||
if (otmp->otyp != TOUCHSTONE) {
|
||||
if (tstone->otyp != TOUCHSTONE) {
|
||||
pline(ambiguous_scratch);
|
||||
return;
|
||||
}
|
||||
|
||||
if (material == GOLD) {
|
||||
color = "golden";
|
||||
goto see_streaks;
|
||||
}
|
||||
|
||||
switch (obj->oclass) {
|
||||
case GOLD_CLASS:
|
||||
color = "golden";
|
||||
#ifndef GOLDOBJ
|
||||
/* goldobj back to u.ugold */
|
||||
u.ugold = obj->quan;
|
||||
obj->quan = 0L;
|
||||
dealloc_obj(obj);
|
||||
obj = (struct obj *)0;
|
||||
#endif
|
||||
break;
|
||||
case GEM_CLASS:
|
||||
if (otmp->blessed) {
|
||||
if (tstone->blessed || (!tstone->cursed &&
|
||||
(Role_if(PM_ARCHEOLOGIST) || Race_if(PM_GNOME)))) {
|
||||
makeknown(TOUCHSTONE);
|
||||
makeknown(obj->otyp);
|
||||
prinv((char *)0, obj, 0L);
|
||||
@@ -1932,14 +1936,15 @@ struct obj *otmp;
|
||||
pline(ambiguous_scratch); /* yet not ambiguous if a known touchstone */
|
||||
return;
|
||||
}
|
||||
color = c_obj_colors[objects[obj->otyp].oc_color];
|
||||
streak_color = c_obj_colors[objects[obj->otyp].oc_color];
|
||||
break;
|
||||
default:
|
||||
pline(scritch);
|
||||
return;
|
||||
}
|
||||
see_streaks:
|
||||
pline("You see %s streaks on the stone.", color);
|
||||
|
||||
see_streaks:
|
||||
pline("You see %s streaks on the stone.", streak_color);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -33,7 +33,7 @@ static struct trobj Archeologist[] = {
|
||||
{ FOOD_RATION, 0, FOOD_CLASS, 3, 0 },
|
||||
{ PICK_AXE, UNDEF_SPE, TOOL_CLASS, 1, UNDEF_BLESS },
|
||||
{ TINNING_KIT, UNDEF_SPE, TOOL_CLASS, 1, UNDEF_BLESS },
|
||||
{ TOUCHSTONE, 0, GEM_CLASS, 1, 1 },
|
||||
{ TOUCHSTONE, 0, GEM_CLASS, 1, 0 },
|
||||
{ SACK, 0, TOOL_CLASS, 1, 0 },
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
@@ -219,6 +219,7 @@ static struct trobj Money[] = {
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* race-based substitutions for initial inventory;
|
||||
the weaker cloak for elven rangers is intentional--they shoot better */
|
||||
static struct inv_sub { short race_pm, item_otyp, subs_otyp; } inv_subs[] = {
|
||||
|
||||
Reference in New Issue
Block a user