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

Function hmon_hitmon

src/uhitm.c:1753–1935  ·  view source on GitHub ↗

guts of hmon(); returns True if 'mon' survives */

Source from the content-addressed store, hash-verified

1751
1752/* guts of hmon(); returns True if 'mon' survives */
1753staticfn boolean
1754hmon_hitmon(
1755 struct monst *mon,
1756 struct obj *obj,
1757 int thrown, /* HMON_xxx (0 => hand-to-hand, other => ranged) */
1758 int dieroll)
1759{
1760 struct _hitmon_data hmd;
1761 boolean maybe_knockback = FALSE;
1762
1763 hmd.dmg = 0;
1764 hmd.thrown = thrown;
1765 hmd.twohits = thrown ? 0 : gt.twohits;
1766 hmd.dieroll = dieroll;
1767 hmd.mdat = mon->data;
1768 hmd.use_weapon_skill = FALSE;
1769 hmd.train_weapon_skill = FALSE;
1770 hmd.barehand_silver_rings = 0;
1771 hmd.silvermsg = FALSE;
1772 hmd.silverobj = FALSE;
1773 hmd.lightobj = FALSE;
1774 hmd.material = obj ? objects[obj->otyp].oc_material
1775 : NO_MATERIAL;
1776 hmd.jousting = 0;
1777 hmd.hittxt = FALSE;
1778 hmd.get_dmg_bonus = TRUE;
1779 hmd.unarmed = !uwep && !uarm && !uarms;
1780 hmd.hand_to_hand = (thrown == HMON_MELEE
1781 /* not grapnels; applied implies uwep */
1782 || (thrown == HMON_APPLIED && is_pole(uwep)));
1783 hmd.ispoisoned = FALSE;
1784 hmd.unpoisonmsg = FALSE;
1785 hmd.needpoismsg = FALSE;
1786 hmd.poiskilled = FALSE;
1787 hmd.already_killed = FALSE;
1788 hmd.offmap = FALSE;
1789 hmd.destroyed = FALSE;
1790 hmd.dryit = FALSE;
1791 hmd.doreturn = FALSE;
1792 hmd.retval = FALSE;
1793 hmd.saved_oname[0] = '\0';
1794
1795 hmon_hitmon_do_hit(&hmd, mon, obj);
1796 if (hmd.doreturn)
1797 return hmd.retval;
1798
1799 /*
1800 ***** NOTE: perhaps obj is undefined! (if !thrown && BOOMERANG)
1801 * *OR* if attacking bare-handed!
1802 * Note too: the cases where obj might get destroyed do not
1803 * set 'use_weapon_skill', bare-handed does.
1804 */
1805
1806 if (hmd.dmg > 0)
1807 hmon_hitmon_dmg_recalc(&hmd, obj);
1808
1809 if (hmd.ispoisoned)
1810 hmon_hitmon_poison(&hmd, mon, obj);

Callers 1

hmonFunction · 0.85

Calls 15

hmon_hitmon_do_hitFunction · 0.85
hmon_hitmon_dmg_recalcFunction · 0.85
hmon_hitmon_poisonFunction · 0.85
shade_missFunction · 0.85
hmon_hitmon_joustingFunction · 0.85
hmon_hitmon_staggerFunction · 0.85
first_weapon_hitFunction · 0.85
hmon_hitmon_petFunction · 0.85
hmon_hitmon_splitmonFunction · 0.85
hmon_hitmon_msg_hitFunction · 0.85
dry_a_towelFunction · 0.85
hmon_hitmon_msg_silverFunction · 0.85

Tested by

no test coverage detected