Skip to content

Commit

Permalink
Refactor wet_artifact.
Browse files Browse the repository at this point in the history
  • Loading branch information
elunna committed Sep 27, 2023
1 parent 1a7e33f commit 2dbe9af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ E int NDECL(doinvoke);
E boolean FDECL(finesse_ahriman, (struct obj *));
E void FDECL(arti_speak, (struct obj *));
E boolean FDECL(artifact_light, (struct obj *));
E int FDECL(artifact_wet, (struct obj *, BOOLEAN_P));
E boolean FDECL(artifact_wet, (struct obj *));
E long FDECL(spec_mh, (struct obj *));
E boolean FDECL(artifact_has_invprop, (struct obj *, UCHAR_P));
E long FDECL(arti_cost, (struct obj *));
Expand Down
41 changes: 15 additions & 26 deletions src/artifact.c
Original file line number Diff line number Diff line change
Expand Up @@ -4036,40 +4036,29 @@ struct obj *obj;
* This only prints messages about the actual artifact.
*/

int
artifact_wet(obj, silent)
boolean
artifact_wet(obj)
struct obj *obj;
boolean silent;
{
if (!obj->oartifact)
return (-1);
return FALSE;
switch (artilist[(int) (obj)->oartifact].attk.adtyp) {
case AD_FIRE:
if (!silent) {
case AD_FIRE:
pline("A cloud of steam rises.");
pline("%s is untouched.", The(xname(obj)));
}
return (AD_FIRE);
case AD_COLD:
if (!silent) {
return TRUE;
case AD_COLD:
pline("Icicles form and fall from the freezing %s.", xname(obj));
}
return (AD_COLD);
case AD_ELEC:
if (!silent) {
pline_The("humid air crackles with electricity from %s.",
xname(obj));
}
return (AD_ELEC);
case AD_DRLI:
if (!silent) {
return TRUE;
case AD_ELEC:
pline_The("humid air crackles with electricity from %s.", xname(obj));
return TRUE;
case AD_DRLI:
pline("%s absorbs the water!", The(xname(obj)));
}
return (AD_DRLI);
default:
break;
return TRUE;
default:
break;
}
return (-1);
return FALSE;
}

/* WAC return TRUE if artifact is always lit */
Expand Down
2 changes: 1 addition & 1 deletion src/fountain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ register struct obj *obj;
}

/* If it is an artifact, it might have a special effect. */
artifact_wet(obj, FALSE);
artifact_wet(obj);

switch (rnd(30)) {
case 16: /* Curse the item */
Expand Down
2 changes: 1 addition & 1 deletion src/potion.c
Original file line number Diff line number Diff line change
Expand Up @@ -3068,7 +3068,7 @@ boolean ourfault;
/* Just "fall through" to generic rustprone check for now. */
/* fall through */
default:
if (artifact_wet(targobj, FALSE) != -1)
if (artifact_wet(targobj))
return TRUE;

if (targobj->spe > 0) {
Expand Down

0 comments on commit 2dbe9af

Please sign in to comment.