Fold get_wet() into water_damage().

This now ensures that dipping into water works like other sources of
water damage. There is a potentially significant gameplay change here:
dipping a container into uncursed water will wet all its contents. If
this is a problem, then we should add another parameter to water_damage
which will suppress this behaviour for dipping.
This commit is contained in:
Sean Hunt
2015-02-24 15:26:09 -05:00
parent 57dcad3774
commit 3acd3c4a00
5 changed files with 6 additions and 98 deletions

View File

@@ -864,7 +864,7 @@ grease protects from all types of erosion
all sources of erosion now affect objects the same way
passive attacks no longer erode armor covered by other armor
dipping a fooproof item into acid no longer forgets that it's fooproof
dipping a container into uncursed water now gets its contents wet
Platform- and/or Interface-Specific Fixes
-----------------------------------------

View File

@@ -1726,7 +1726,6 @@ E void FDECL(healup, (int,int,BOOLEAN_P,BOOLEAN_P));
E void FDECL(strange_feeling, (struct obj *,const char *));
E void FDECL(potionhit, (struct monst *,struct obj *,BOOLEAN_P));
E void FDECL(potionbreathe, (struct obj *));
E boolean FDECL(get_wet, (struct obj *));
E int NDECL(dodip);
E void FDECL(mongrantswish, (struct monst **));
E void FDECL(djinni_from_bottle, (struct obj *));

View File

@@ -402,7 +402,7 @@ register struct obj *obj;
if(in_town(u.ux, u.uy))
(void) angry_guards(FALSE);
return;
} else if (get_wet(obj)) {
} else if (water_damage(obj, NULL, TRUE)) {
if (obj->otyp == POT_ACID) { /* Acid and water don't mix */
useup(obj);
return;

View File

@@ -1088,7 +1088,7 @@ const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
} else {
/* dipping into uncursed water; carried() check skips steed saddle */
if (carried(targobj)) {
if (get_wet(targobj))
if (water_damage(targobj, 0, TRUE))
res = TRUE;
}
}
@@ -1626,98 +1626,6 @@ register struct obj *o1, *o2;
return 0;
}
boolean
get_wet(obj)
register struct obj *obj;
/* returns TRUE if something happened (potion should be used up) */
{
if (snuff_lit(obj)) return(TRUE);
if (obj->greased) {
grease_protect(obj,(char *)0,&youmonst);
return(FALSE);
}
/* (Rusting shop goods ought to be charged for.) */
switch (obj->oclass) {
case POTION_CLASS:
if (obj->otyp == POT_WATER) return FALSE;
/* KMH -- Water into acid causes an explosion */
if (obj->otyp == POT_ACID) {
pline("It boils vigorously!");
You("are caught in the explosion!");
losehp(Maybe_Half_Phys(rnd(10)), "elementary chemistry",
KILLED_BY);
makeknown(obj->otyp);
update_inventory();
return (TRUE);
}
pline("%s%s.", Yobjnam2(obj,"dilute"),
obj->odiluted ? " further" : "");
costly_alteration(obj, COST_DILUTE);
if (obj->odiluted) {
obj->odiluted = 0;
obj->blessed = FALSE;
obj->cursed = FALSE;
obj->otyp = POT_WATER;
} else
obj->odiluted++;
update_inventory();
return TRUE;
case SCROLL_CLASS:
if (obj->otyp != SCR_BLANK_PAPER
#ifdef MAIL
&& obj->otyp != SCR_MAIL
#endif
) {
if (!Blind)
pline_The("scroll%s %s.",
plur(obj->quan), otense(obj, "fade"));
costly_alteration(obj, COST_ERASE);
obj->otyp = SCR_BLANK_PAPER;
obj->spe = 0;
update_inventory();
return TRUE;
} else break;
case SPBOOK_CLASS:
if (obj->otyp != SPE_BLANK_PAPER) {
if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
pline(
"%s suddenly heats up; steam rises and it remains dry.",
The(xname(obj)));
} else {
if (!Blind)
pline_The("spellbook%s %s.",
plur(obj->quan),
otense(obj, "fade"));
costly_alteration(obj, COST_ERASE);
obj->otyp = SPE_BLANK_PAPER;
update_inventory();
}
return TRUE;
}
break;
case WEAPON_CLASS:
/* Just "fall through" to generic rustprone check for now. */
/* fall through */
default:
if (!obj->oerodeproof && is_rustprone(obj) &&
(obj->oeroded < MAX_ERODE) && !rn2(2)) {
pline("%s some%s.",
Yobjnam2(obj, "rust"),
obj->oeroded ? " more" : "what");
obj->oeroded++;
update_inventory();
return TRUE;
}
break;
}
pline("%s wet.", Yobjnam2(obj, "get"));
return FALSE;
}
int
dodip()
{
@@ -1756,7 +1664,7 @@ dodip()
rider_cant_reach(); /* not skilled enough to reach */
} else {
if (obj->otyp == POT_ACID) obj->in_use = 1;
(void) get_wet(obj);
(void) water_damage(obj, 0, TRUE);
if (obj->in_use) useup(obj);
}
return 1;

View File

@@ -3118,7 +3118,8 @@ boolean force;
{
boolean loose_obj = (obj && obj->where == OBJ_FREE), exploded = FALSE;
(void) snuff_lit(obj);
if (snuff_lit(obj))
return 2;
if(obj->otyp == CAN_OF_GREASE && obj->spe > 0) {
return 0;