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

Function stolen_booty

src/mkmaze.c:798–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796}
797
798staticfn void
799stolen_booty(void)
800{
801 char *gang, gang_name[BUFSZ];
802 struct monst *mtmp;
803 int cnt, i, otyp;
804
805 /*
806 * --------------------------------------------------------
807 * Mythos:
808 *
809 * A tragic accident has occurred in Frontier Town...
810 * It has been overrun by orcs.
811 *
812 * The booty that the orcs took from the town is now
813 * in the possession of the orcs that did this and
814 * have long since fled the level.
815 * --------------------------------------------------------
816 */
817
818 gang = rndorcname(gang_name);
819 /* create the stuff that the gang took */
820 cnt = rnd(4);
821 for (i = 0; i < cnt; ++i)
822 migr_booty_item(rn2(4) ? TALLOW_CANDLE : WAX_CANDLE, gang);
823 cnt = rnd(3);
824 for (i = 0; i < cnt; ++i)
825 migr_booty_item(SKELETON_KEY, gang);
826 otyp = rn1((GAUNTLETS_OF_DEXTERITY - LEATHER_GLOVES) + 1, LEATHER_GLOVES);
827 migr_booty_item(otyp, gang);
828 cnt = rnd(10);
829 for (i = 0; i < cnt; ++i) {
830 /* Food items - but no lembas! (or some other weird things) */
831 otyp = rn1(TIN - TRIPE_RATION + 1, TRIPE_RATION);
832 if (otyp != LEMBAS_WAFER
833 /* exclude meat <anything>, globs of <anything>, kelp
834 which all have random generation probability of 0
835 (K-/C-rations do too, but we want to include those) */
836 && (objects[otyp].oc_prob != 0
837 || otyp == C_RATION || otyp == K_RATION)
838 /* exclude food items which utilize obj->corpsenm because
839 that field is going to be overloaded for delivery purposes */
840 && otyp != CORPSE && otyp != EGG && otyp != TIN)
841 migr_booty_item(otyp, gang);
842 }
843 migr_booty_item(rn2(2) ? LONG_SWORD : SILVER_SABER, gang);
844 /* create the leader of the orc gang */
845 mtmp = makemon(&mons[PM_ORC_CAPTAIN], 0, 0, MM_NONAME);
846 if (mtmp) {
847 mtmp = christen_monst(mtmp, upstart(gang));
848 mtmp->mpeaceful = 0;
849 set_malign(mtmp);
850 shiny_orc_stuff(mtmp);
851 migrate_orc(mtmp, ORC_LEADER);
852 }
853 /* Make most of the orcs on the level be part of the invading gang */
854 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
855 if (DEADMONSTER(mtmp))

Callers 1

fixup_specialFunction · 0.85

Calls 11

rndorcnameFunction · 0.85
rndFunction · 0.85
migr_booty_itemFunction · 0.85
rn2Function · 0.85
makemonFunction · 0.85
christen_monstFunction · 0.85
upstartFunction · 0.85
set_malignFunction · 0.85
shiny_orc_stuffFunction · 0.85
migrate_orcFunction · 0.85
christen_orcFunction · 0.85

Tested by

no test coverage detected