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

Function hmon_hitmon_splitmon

src/uhitm.c:1603–1634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1601}
1602
1603staticfn void
1604hmon_hitmon_splitmon(
1605 struct _hitmon_data *hmd,
1606 struct monst *mon,
1607 struct obj *obj) /* obj can be NULL but guards are in place below */
1608{
1609 if ((hmd->mdat == &mons[PM_BLACK_PUDDING]
1610 || hmd->mdat == &mons[PM_BROWN_PUDDING])
1611 /* pudding is alive and healthy enough to split */
1612 && mon->mhp > 1 && !mon->mcan && !hmd->offmap
1613 /* iron weapon using melee or polearm hit [3.6.1: metal weapon too;
1614 also allow either or both weapons to cause split when twoweap] */
1615 && obj && (obj == uwep || (u.twoweap && obj == uswapwep))
1616 && ((hmd->material == IRON
1617 /* allow scalpel and tsurugi to split puddings */
1618 || hmd->material == METAL)
1619 /* but not bashing with darts, arrows or ya */
1620 && !(is_ammo(obj) || is_missile(obj)))
1621 && hmd->hand_to_hand) {
1622 struct monst *mclone;
1623 char withwhat[BUFSZ];
1624
1625 if ((mclone = clone_mon(mon, 0, 0)) != 0) {
1626 withwhat[0] = '\0';
1627 if (u.twoweap && flags.verbose)
1628 Sprintf(withwhat, " with %s", yname(obj));
1629 pline("%s divides as you hit it%s!", Monnam(mon), withwhat);
1630 hmd->hittxt = TRUE;
1631 (void) mintrap(mclone, NO_TRAP_FLAGS);
1632 }
1633 }
1634}
1635
1636staticfn void
1637hmon_hitmon_msg_hit(

Callers 1

hmon_hitmonFunction · 0.85

Calls 5

clone_monFunction · 0.85
ynameFunction · 0.85
MonnamFunction · 0.85
mintrapFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected