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

Function double_punch

src/uhitm.c:735–754  ·  view source on GitHub ↗

returns True if hero is fighting without a weapon and without a shield and has sufficient skill in bare-handed/martial arts to attack twice */

Source from the content-addressed store, hash-verified

733/* returns True if hero is fighting without a weapon and without a shield and
734 has sufficient skill in bare-handed/martial arts to attack twice */
735staticfn boolean
736double_punch(void)
737{
738 /* note: P_BARE_HANDED_COMBAT and P_MARTIAL_ARTS are equivalent */
739 int skl_lvl = P_SKILL(P_BARE_HANDED_COMBAT);
740
741 /*
742 * Chance to attempt a second bare-handed or martial arts hit:
743 * restricted (0), [not applicable; no one is restricted]
744 * unskilled (1) : 0%
745 * basic (2) : 0%
746 * skilled (3) : 20%
747 * expert (4) : 40%
748 * master (5) : 60%
749 * grandmaster (6) : 80%
750 */
751 if (!uwep && !uarms && skl_lvl > P_BASIC)
752 return (skl_lvl - P_BASIC) > rn2(5);
753 return FALSE;
754}
755
756/* hit target monster; returns TRUE if it still lives */
757staticfn boolean

Callers 1

hitumFunction · 0.85

Calls 1

rn2Function · 0.85

Tested by

no test coverage detected