From 3acd3c4a0058e72a29bc5b8e2a9b6877d23a0f1e Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Tue, 24 Feb 2015 15:26:09 -0500 Subject: [PATCH] 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. --- doc/fixes35.0 | 2 +- include/extern.h | 1 - src/fountain.c | 2 +- src/potion.c | 96 +----------------------------------------------- src/trap.c | 3 +- 5 files changed, 6 insertions(+), 98 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9dc59fa66..d3f6b1a90 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 ----------------------------------------- diff --git a/include/extern.h b/include/extern.h index f9fc3be0c..4da79874d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 *)); diff --git a/src/fountain.c b/src/fountain.c index cc8aeb7bf..7de917ad9 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -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; diff --git a/src/potion.c b/src/potion.c index 782fa7ace..4c57eaecb 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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; diff --git a/src/trap.c b/src/trap.c index d535fc230..6a5cb3755 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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; -- 2.40.0