fix github pull request #418 - towel wetness
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
This commit is contained in:
@@ -332,6 +332,10 @@ selling a container to a shop for gold leaves any contents that the shop
|
||||
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
|
||||
|
||||
@@ -89,7 +89,7 @@ struct monst *victim;
|
||||
/* 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)
|
||||
@@ -3882,7 +3882,10 @@ boolean force;
|
||||
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))
|
||||
|
||||
10
src/weapon.c
10
src/weapon.c
@@ -984,16 +984,18 @@ boolean verbose;
|
||||
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) {
|
||||
@@ -1013,6 +1015,8 @@ boolean verbose;
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user