MCPcopy Create free account
hub / github.com/NetHack/NetHack / wet_a_towel

Function wet_a_towel

src/weapon.c:1037–1063  ·  view source on GitHub ↗

increase a towel's wetness */

Source from the content-addressed store, hash-verified

1035
1036/* increase a towel's wetness */
1037void
1038wet_a_towel(
1039 struct obj *obj,
1040 int amt, /* positive: new val; negative: increment by -amt; zero: no-op */
1041 boolean verbose)
1042{
1043 int newspe = (amt <= 0) ? obj->spe - amt : amt;
1044
1045 /* new state is only reported if it's an increase */
1046 if (newspe > obj->spe) {
1047 if (verbose) {
1048 const char *wetness = (newspe < 3)
1049 ? (!obj->spe ? "damp" : "damper")
1050 : (!obj->spe ? "wet" : "wetter");
1051
1052 if (carried(obj))
1053 pline("%s gets %s.", Yobjnam2(obj, (const char *) 0),
1054 wetness);
1055 else if (mcarried(obj) && canseemon(obj->ocarry))
1056 pline("%s %s gets %s.", s_suffix(Monnam(obj->ocarry)),
1057 xname(obj), wetness);
1058 }
1059 }
1060
1061 if (newspe != obj->spe)
1062 finish_towel_change(obj, newspe);
1063}
1064
1065/* decrease a towel's wetness; unlike when wetting, 0 is not a no-op */
1066void

Callers 1

water_damageFunction · 0.85

Calls 7

Yobjnam2Function · 0.85
canseemonFunction · 0.85
s_suffixFunction · 0.85
MonnamFunction · 0.85
xnameFunction · 0.85
finish_towel_changeFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected