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

Function shiny_orc_stuff

src/mkmaze.c:747–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745}
746
747staticfn void
748shiny_orc_stuff(struct monst *mtmp)
749{
750 int gemprob, goldprob, otyp;
751 struct obj *otmp;
752 boolean is_captain = (mtmp->data == &mons[PM_ORC_CAPTAIN]);
753
754 /* probabilities */
755 goldprob = is_captain ? 600 : 300;
756 gemprob = goldprob / 4;
757 if (rn2(1000) < goldprob) {
758 if ((otmp = mksobj(GOLD_PIECE, TRUE, FALSE)) != 0) {
759 otmp->quan = 1L + rnd(goldprob);
760 otmp->owt = weight(otmp);
761 add_to_minv(mtmp, otmp);
762 }
763 }
764 if (rn2(1000) < gemprob) {
765 if ((otmp = mkobj(GEM_CLASS, FALSE)) != 0) {
766 if (otmp->otyp == ROCK)
767 dealloc_obj(otmp);
768 else
769 add_to_minv(mtmp, otmp);
770 }
771 }
772 if (is_captain || !rn2(8)) {
773 otyp = shiny_obj(RING_CLASS);
774 if (otyp != STRANGE_OBJECT && (otmp = mksobj(otyp, TRUE, FALSE)) != 0)
775 add_to_minv(mtmp, otmp);
776 }
777}
778
779staticfn void
780migr_booty_item(int otyp, const char *gang)

Callers 1

stolen_bootyFunction · 0.85

Calls 8

rn2Function · 0.85
mksobjFunction · 0.85
rndFunction · 0.85
weightFunction · 0.85
add_to_minvFunction · 0.85
mkobjFunction · 0.85
dealloc_objFunction · 0.85
shiny_objFunction · 0.85

Tested by

no test coverage detected