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

Function squadmon

src/mkroom.c:816–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814
815/* return soldier types. */
816staticfn struct permonst *
817squadmon(void)
818{
819 int sel_prob, i, cpro, mndx;
820
821 sel_prob = rnd(80 + level_difficulty());
822
823 cpro = 0;
824 for (i = 0; i < SIZE(squadprob); i++) {
825 cpro += squadprob[i].prob;
826 if (cpro > sel_prob) {
827 mndx = squadprob[i].pm;
828 goto gotone;
829 }
830 }
831 mndx = ROLL_FROM(squadprob).pm;
832 gotone:
833 if (!(svm.mvitals[mndx].mvflags & G_GONE))
834 return &mons[mndx];
835 else
836 return (struct permonst *) 0;
837}
838
839/*
840 * save_room : A recursive function that saves a room and its subrooms

Callers 1

fill_zooFunction · 0.85

Calls 2

rndFunction · 0.85
level_difficultyFunction · 0.85

Tested by

no test coverage detected