From 674b8c6b07690aad2f929e251badbc78205c1642 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Wed, 25 Oct 2023 14:16:09 -0400 Subject: [PATCH] Add additional sink potion #dipping effects Also put "Nothing seems to happen." into c_common_strings, since it's used all over several files. --- include/decl.h | 1 + include/extern.h | 1 + include/hack.h | 10 ++++---- src/apply.c | 15 ++++++------ src/decl.c | 1 + src/dokick.c | 21 +--------------- src/fountain.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++-- src/makemon.c | 2 +- src/pickup.c | 2 +- src/potion.c | 2 +- 10 files changed, 80 insertions(+), 38 deletions(-) diff --git a/include/decl.h b/include/decl.h index 98110f3d7..0de9f8470 100644 --- a/include/decl.h +++ b/include/decl.h @@ -29,6 +29,7 @@ extern NEARDATA const struct c_color_names c_color_names; /* common_strings */ extern const struct c_common_strings c_common_strings; #define nothing_happens c_common_strings.c_nothing_happens +#define nothing_seems_to_happen c_common_strings.c_nothing_seems_to_happen #define thats_enough_tries c_common_strings.c_thats_enough_tries #define silly_thing_to c_common_strings.c_silly_thing_to #define shudder_for_moment c_common_strings.c_shudder_for_moment diff --git a/include/extern.h b/include/extern.h index 276b0c473..22c374bbd 100644 --- a/include/extern.h +++ b/include/extern.h @@ -977,6 +977,7 @@ extern int wash_hands(void); extern void breaksink(coordxy, coordxy); extern void drinksink(void); extern void dipsink(struct obj *); +extern void sink_backs_up(coordxy, coordxy); /* ### hack.c ### */ diff --git a/include/hack.h b/include/hack.h index 5a1281bc3..c281fa2eb 100644 --- a/include/hack.h +++ b/include/hack.h @@ -270,11 +270,11 @@ struct c_color_names { }; struct c_common_strings { - const char *const c_nothing_happens, *const c_thats_enough_tries, - *const c_silly_thing_to, *const c_shudder_for_moment, - *const c_something, *const c_Something, *const c_You_can_move_again, - *const c_Never_mind, *c_vision_clears, *const c_the_your[2], - *const c_fakename[2]; + const char *const c_nothing_happens, *const c_nothing_seems_to_happen, + *const c_thats_enough_tries, *const c_silly_thing_to, + *const c_shudder_for_moment, *const c_something, *const c_Something, + *const c_You_can_move_again, *const c_Never_mind, *c_vision_clears, + *const c_the_your[2], *const c_fakename[2]; }; struct container { diff --git a/src/apply.c b/src/apply.c index f05399e6b..80a0a5bf4 100644 --- a/src/apply.c +++ b/src/apply.c @@ -49,7 +49,6 @@ static boolean get_valid_polearm_position(coordxy, coordxy); static boolean find_poleable_mon(coord *, int, int); static const char - Nothing_seems_to_happen[] = "Nothing seems to happen.", no_elbow_room[] = "don't have enough elbow-room to maneuver."; static int @@ -1010,7 +1009,7 @@ use_mirror(struct obj *obj) if (!Blind) pline_The("%s fogs up and doesn't reflect!", mirror); else - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); return ECMD_TIME; } if (!u.dx && !u.dy && !u.dz) { @@ -1629,7 +1628,7 @@ use_lamp(struct obj *obj) if (!Blind) Your("lantern is out of power."); else - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); } else { pline("This %s has no oil.", xname(obj)); } @@ -1644,7 +1643,7 @@ use_lamp(struct obj *obj) pline("%s for a moment, then %s.", Tobjnam(obj, "flicker"), otense(obj, "die")); } else { - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); } } else { if (lamp) { /* lamp or lantern */ @@ -2232,7 +2231,7 @@ use_unicorn_horn(struct obj **optr) break; case 6: if (Deaf) /* make_deaf() won't give feedback when already deaf */ - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); make_deaf((HDeaf & TIMEOUT) + lcount, TRUE); break; } @@ -2320,7 +2319,7 @@ use_unicorn_horn(struct obj **optr) if (did_prop) gc.context.botl = TRUE; else - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); #undef PROP_COUNT #undef prop_trouble @@ -3519,7 +3518,7 @@ use_royal_jelly(struct obj **optr) if (eobj->timed || eobj->corpsenm != oldcorpsenm) pline("The %s %s feebly.", xname(eobj), otense(eobj, "quiver")); else - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); kill_egg(eobj); goto useup_jelly; } @@ -3538,7 +3537,7 @@ use_royal_jelly(struct obj **optr) || eobj->corpsenm != oldcorpsenm) pline("The %s %s briefly.", xname(eobj), otense(eobj, "quiver")); else - pline("%s", Nothing_seems_to_happen); + pline("%s", nothing_seems_to_happen); useup_jelly: /* not useup() because we've already done freeinv() */ diff --git a/src/decl.c b/src/decl.c index bfccddc68..b225212a5 100644 --- a/src/decl.c +++ b/src/decl.c @@ -38,6 +38,7 @@ const char *c_obj_colors[] = { const struct c_common_strings c_common_strings = { "Nothing happens.", + "Nothing seems to happen.", "That's enough tries!", "That is a silly thing to %s.", "shudder for a moment.", diff --git a/src/dokick.c b/src/dokick.c index b9935f11b..45004a8ef 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -960,7 +960,6 @@ dokick(void) int glyph, oldglyph = -1; register struct monst *mtmp; boolean no_kick = FALSE; - char buf[BUFSZ]; if (nolimbs(gy.youmonst.data) || slithy(gy.youmonst.data)) { You("have no legs to kick with."); @@ -1421,25 +1420,7 @@ dokick(void) exercise(A_DEX, TRUE); return ECMD_TIME; } else if (!rn2(3)) { - if (Blind && Deaf) - Sprintf(buf, " %s", body_part(FACE)); - else - buf[0] = '\0'; - pline("%s%s%s.", !Deaf ? "Flupp! " : "", - !Blind - ? "Muddy waste pops up from the drain" - : !Deaf - ? "You hear a sloshing sound" /* Deaf-aware */ - : "Something splashes you in the", buf); - if (!(gm.maploc->looted & S_LRING)) { /* once per sink */ - if (!Blind) - You_see("a ring shining in its midst."); - (void) mkobj_at(RING_CLASS, x, y, TRUE); - newsym(x, y); - exercise(A_DEX, TRUE); - exercise(A_WIS, TRUE); /* a discovery! */ - gm.maploc->looted |= S_LRING; - } + sink_backs_up(x, y); return ECMD_TIME; } kick_ouch(x, y, ""); diff --git a/src/fountain.c b/src/fountain.c index bd50916e9..ade9b9471 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -535,7 +535,7 @@ dipfountain(register struct obj *obj) break; default: if (er == ER_NOTHING) - pline("Nothing seems to happen."); + pline1(nothing_seems_to_happen); break; } update_inventory(); @@ -705,7 +705,7 @@ dipsink(struct obj *obj) } else if (obj->oclass != POTION_CLASS) { You("hold %s under the tap.", the(xname(obj))); if (water_damage(obj, (const char *) 0, TRUE) == ER_NOTHING) - pline("Nothing seems to happen."); + pline1(nothing_seems_to_happen); return; } @@ -721,8 +721,43 @@ dipsink(struct obj *obj) if (!Blind) { pline("It leaves an oily film on the basin."); try_call = TRUE; + } else { + pline1(nothing_seems_to_happen); } break; + case POT_ACID: + /* acts like a drain cleaner product */ + try_call = TRUE; + if (!Blind) { + pline_The("drain seems less clogged."); + } else if (!Deaf) { + You_hear("a sucking sound."); + } else { + pline1(nothing_seems_to_happen); + try_call = FALSE; + } + break; + case POT_LEVITATION: + sink_backs_up(u.ux, u.uy); + try_call = TRUE; + break; + case POT_OBJECT_DETECTION: + if (!(levl[u.ux][u.uy].looted & S_LRING)) { + You("sense a ring lost down the drain."); + try_call = TRUE; + break; + } + /* FALLTHRU */ + case POT_GAIN_LEVEL: + case POT_GAIN_ENERGY: + case POT_MONSTER_DETECTION: + case POT_FRUIT_JUICE: + case POT_WATER: + /* potions with no potionbreathe() effects, plus water. if effects + are added to potionbreathe these should go to that instead (except + for water). */ + pline1(nothing_seems_to_happen); + break; default: /* hero can feel the vapor on her skin, so no need to check Blind or breathless for this message */ @@ -737,4 +772,28 @@ dipsink(struct obj *obj) useup(obj); } +void +sink_backs_up(coordxy x, coordxy y) +{ + char buf[BUFSZ]; + + if (!Blind) + Strcpy(buf, "Muddy waste pops up from the drain"); + else if (!Deaf) + Strcpy(buf, "You hear a sloshing sound"); /* Deaf-aware */ + else + Sprintf(buf, "Something splashes you in the %s", body_part(FACE)); + pline("%s%s.", !Deaf ? "Flupp! " : "", buf); + + if (!(levl[x][y].looted & S_LRING)) { /* once per sink */ + if (!Blind) + You_see("a ring shining in its midst."); + (void) mkobj_at(RING_CLASS, x, y, TRUE); + newsym(x, y); + exercise(A_DEX, TRUE); + exercise(A_WIS, TRUE); /* a discovery! */ + levl[x][y].looted |= S_LRING; + } +} + /*fountain.c*/ diff --git a/src/makemon.c b/src/makemon.c index 984280e22..e21986cf2 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -2422,7 +2422,7 @@ bagotricks( update_inventory(); /* for perm_invent */ } } else if (!tipping) { - pline1(!moncount ? nothing_happens : "Nothing seems to happen."); + pline1(!moncount ? nothing_happens : nothing_seems_to_happen); } } return moncount; diff --git a/src/pickup.c b/src/pickup.c index a145b8fe0..e2c3c7064 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -3842,7 +3842,7 @@ tipcontainer_checks( if (box->spe < old_spe) { if (bag && !totseen) - pline("Nothing seems to happen."); + pline1(nothing_seems_to_happen); /* check_unpaid wants to see a non-zero charge count */ box->spe = old_spe; check_unpaid_usage(box, TRUE); diff --git a/src/potion.c b/src/potion.c index df9ea729a..87e406fcc 100644 --- a/src/potion.c +++ b/src/potion.c @@ -2405,7 +2405,7 @@ potion_dip(struct obj *obj, struct obj *potion) prinv((char *) 0, obj, 0L); return ECMD_TIME; } else { - pline("Nothing seems to happen."); + pline1(nothing_seems_to_happen); goto poof; } }