MCPcopy Index your code
hub / github.com/NetHack/NetHack / propagate

Function propagate

src/makemon.c:957–982  ·  view source on GitHub ↗

* Propagate a species * * Once a certain number of monsters are created, don't create any more * at random (i.e. make them extinct). The previous (3.2) behavior was * to do this when a certain number had _died_, which didn't make * much sense. * * Returns FALSE propagation unsuccessful * TRUE propagation successful */

Source from the content-addressed store, hash-verified

955 * TRUE propagation successful
956 */
957boolean
958propagate(int mndx, boolean tally, boolean ghostly)
959{
960 boolean gone, result;
961 int lim = mbirth_limit(mndx);
962
963 gone = (svm.mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
964 result = ((int) svm.mvitals[mndx].born < lim && !gone) ? TRUE : FALSE;
965
966 /* if it's unique, don't ever make it again */
967 if ((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC)
968 svm.mvitals[mndx].mvflags |= G_EXTINCT;
969
970 if (svm.mvitals[mndx].born < 255 && tally && (!ghostly || result))
971 svm.mvitals[mndx].born++;
972 if ((int) svm.mvitals[mndx].born >= lim
973 && !(mons[mndx].geno & G_NOGEN)
974 && !(svm.mvitals[mndx].mvflags & G_EXTINCT)) {
975 if (wizard) {
976 debugpline1("Automatically extinguished %s.",
977 makeplural(mons[mndx].pmnames[NEUTRAL]));
978 }
979 svm.mvitals[mndx].mvflags |= G_EXTINCT;
980 }
981 return result;
982}
983
984/* amount of HP to lose from level drain (or gain from Stormbringer) */
985int

Callers 3

restmonchnFunction · 0.85
makemonFunction · 0.85
create_objectFunction · 0.85

Calls 2

mbirth_limitFunction · 0.85
makepluralFunction · 0.85

Tested by

no test coverage detected