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

Function can_be_hatched

src/mon.c:5545–5565  ·  view source on GitHub ↗

* Determine if the given monster number can be hatched from an egg. * Return the monster number to use as the egg's corpsenm. Return * NON_PM if the given monster can't be hatched. */

Source from the content-addressed store, hash-verified

5543 * NON_PM if the given monster can't be hatched.
5544 */
5545int
5546can_be_hatched(int mnum)
5547{
5548 /* ranger quest nemesis has the oviparous bit set, making it
5549 be possible to wish for eggs of that unique monster; turn
5550 such into ordinary eggs rather than forbidding them outright */
5551 if (mnum == PM_SCORPIUS)
5552 mnum = PM_SCORPION;
5553
5554 mnum = little_to_big(mnum);
5555 /*
5556 * Queen bees lay killer bee eggs (usually), but killer bees don't
5557 * grow into queen bees. Ditto for [winged-]gargoyles.
5558 */
5559 if (mnum == PM_KILLER_BEE || mnum == PM_GARGOYLE
5560 || (lays_eggs(&mons[mnum])
5561 && (BREEDER_EGG
5562 || (mnum != PM_QUEEN_BEE && mnum != PM_WINGED_GARGOYLE))))
5563 return mnum;
5564 return NON_PM;
5565}
5566
5567/* type of egg laid by #sit; usually matches parent */
5568int

Callers 4

readobjnamFunction · 0.85
mksobj_initFunction · 0.85
set_mimic_symFunction · 0.85
poly_objFunction · 0.85

Calls 1

little_to_bigFunction · 0.85

Tested by

no test coverage detected