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

Function migrate_orc

src/mkmaze.c:716–745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714static const char *const orcfruit[] = { "paddle cactus", "dwarven root" };
715
716staticfn void
717migrate_orc(struct monst *mtmp, unsigned long mflags)
718{
719 int nlev, max_depth, cur_depth;
720 d_level dest;
721
722 cur_depth = (int) depth(&u.uz);
723 max_depth = dunlevs_in_dungeon(&u.uz)
724 + (svd.dungeons[u.uz.dnum].depth_start - 1);
725 if (mflags == ORC_LEADER) {
726 /* Note that the orc leader will take possession of any
727 * remaining stuff not already delivered to other
728 * orcs between here and the bottom of the mines.
729 */
730 nlev = max_depth;
731 /* once in a blue moon, he won't be at the very bottom */
732 if (!rn2(40))
733 nlev--;
734 mtmp->migflags |= MIGR_LEFTOVERS;
735 } else {
736 nlev = rn2((max_depth - cur_depth) + 1) + cur_depth;
737 if (nlev == cur_depth)
738 nlev++;
739 if (nlev > max_depth)
740 nlev = max_depth;
741 mtmp->migflags = (mtmp->migflags & ~MIGR_LEFTOVERS);
742 }
743 get_level(&dest, nlev);
744 migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0);
745}
746
747staticfn void
748shiny_orc_stuff(struct monst *mtmp)

Callers 1

stolen_bootyFunction · 0.85

Calls 6

depthFunction · 0.85
dunlevs_in_dungeonFunction · 0.85
rn2Function · 0.85
get_levelFunction · 0.85
migrate_to_levelFunction · 0.85
ledger_noFunction · 0.85

Tested by

no test coverage detected