Fire damage would dry out a wet towel but never all the way to 0.
Water damage would wet a towel but if it was already wet, its
wetness might decrease.
This uses the pull request's change for increasing the wetness
but changes dry_a_towel so that the original code for decreasing
that will work as is. Using wet_a_towel() to set wetness to 0
doesn't make much sense, so still won't do so; dry_a_towel() does
and now will.
This also adds missing perm_invent update for towels in inventory
changing wetness.
Fixes #418
contents without giving any additional credit; mark out of place
contents 'no_charge' so that hero can reclaim them without buying
add some new demonic and angelic maledictions
+when fire damage dried a wet towel, it would never reduce the wetness to 0
+when water damage wet a towel, the new wetness might randomly become less
+when the wetness of a towel in inventory changed, persistent inventory wasn't
+ updated to show that
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
/* burning damage may dry wet towel */
item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL);
while (item) {
- if (is_wet_towel(item)) {
+ if (is_wet_towel(item)) { /* True => (item->spe > 0) */
oldspe = item->spe;
dry_a_towel(item, rn2(oldspe + 1), TRUE);
if (item->spe != oldspe)
if (obj->otyp == CAN_OF_GREASE && obj->spe > 0) {
return ER_NOTHING;
} else if (obj->otyp == TOWEL && obj->spe < 7) {
- wet_a_towel(obj, rnd(7), TRUE);
+ /* a negative change induces a reverse increment, adding abs(change);
+ spe starts 0..6, arg passed to rnd() is 1..7, change is -7..-1,
+ final spe is 1..7 and always greater than its starting value */
+ wet_a_towel(obj, -rnd(7 - obj->spe), TRUE);
return ER_NOTHING;
} else if (obj->greased) {
if (!rn2(2))
with your wet towel" message on next attack with it */
if (obj == uwep)
g.unweapon = !is_wet_towel(obj);
+ if (carried(obj))
+ update_inventory();
}
-/* decrease a towel's wetness */
+/* decrease a towel's wetness; unlike when wetting, 0 is not a no-op */
void
dry_a_towel(obj, amt, verbose)
struct obj *obj;
-int amt; /* positive: new value; negative: decrement by -amt; zero: no-op */
+int amt; /* positive or zero: new value; negative: decrement by abs(amt) */
boolean verbose;
{
- int newspe = (amt <= 0) ? obj->spe + amt : amt;
+ int newspe = (amt < 0) ? obj->spe + amt : amt;
/* new state is only reported if it's a decrease */
if (newspe < obj->spe) {
bashing with your towel" message on next attack with it */
if (obj == uwep)
g.unweapon = !is_wet_towel(obj);
+ if (carried(obj))
+ update_inventory();
}
/* copy the skill level name into the given buffer */