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

Function spec_dbon

src/artifact.c:1090–1109  ·  view source on GitHub ↗

special damage bonus */

Source from the content-addressed store, hash-verified

1088
1089/* special damage bonus */
1090int
1091spec_dbon(struct obj *otmp, struct monst *mon, int tmp)
1092{
1093 const struct artifact *weap = get_artifact(otmp);
1094
1095 if ((weap == &artilist[ART_NONARTIFACT])
1096 || (weap->attk.adtyp == AD_PHYS /* check for `NO_ATTK' */
1097 && weap->attk.damn == 0 && weap->attk.damd == 0))
1098 gs.spec_dbon_applies = FALSE;
1099 else if (is_art(otmp, ART_GRIMTOOTH))
1100 /* Grimtooth has SPFX settings to warn against elves but we want its
1101 damage bonus to apply to all targets, so bypass spec_applies() */
1102 gs.spec_dbon_applies = TRUE;
1103 else
1104 gs.spec_dbon_applies = spec_applies(weap, mon);
1105
1106 if (gs.spec_dbon_applies)
1107 return weap->attk.damd ? rnd((int) weap->attk.damd) : max(tmp, 1);
1108 return 0;
1109}
1110
1111/* add identified artifact to discoveries list */
1112void

Callers 2

dmgvalFunction · 0.85
artifact_hitFunction · 0.85

Calls 4

get_artifactFunction · 0.85
is_artFunction · 0.85
spec_appliesFunction · 0.85
rndFunction · 0.85

Tested by

no test coverage detected