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

Function slots_required

src/weapon.c:1131–1152  ·  view source on GitHub ↗

return the # of slots required to advance the skill */

Source from the content-addressed store, hash-verified

1129
1130/* return the # of slots required to advance the skill */
1131staticfn int
1132slots_required(int skill)
1133{
1134 int tmp = P_SKILL(skill);
1135
1136 /* The more difficult the training, the more slots it takes.
1137 * unskilled -> basic 1
1138 * basic -> skilled 2
1139 * skilled -> expert 3
1140 */
1141 if (skill <= P_LAST_WEAPON || skill == P_TWO_WEAPON_COMBAT)
1142 return tmp;
1143
1144 /* Fewer slots used up for unarmed or martial.
1145 * unskilled -> basic 1
1146 * basic -> skilled 1
1147 * skilled -> expert 2
1148 * expert -> master 2
1149 * master -> grand master 3
1150 */
1151 return (tmp + 1) / 2;
1152}
1153
1154/* return true if this skill can be advanced */
1155boolean

Callers 4

can_advanceFunction · 0.85
skill_advanceFunction · 0.85
lose_weapon_skillFunction · 0.85
drain_weapon_skillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected