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

Function lose_weapon_skill

src/weapon.c:1452–1473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1450}
1451
1452void
1453lose_weapon_skill(int n) /* number of slots to lose; normally one */
1454{
1455 int skill;
1456
1457 while (--n >= 0) {
1458 /* deduct first from unused slots then from last placed one, if any */
1459 if (u.weapon_slots) {
1460 u.weapon_slots--;
1461 } else if (u.skills_advanced) {
1462 skill = u.skill_record[--u.skills_advanced];
1463 if (P_SKILL(skill) <= P_UNSKILLED)
1464 panic("lose_weapon_skill (%d)", skill);
1465 P_SKILL(skill)--; /* drop skill one level */
1466 /* Lost skill might have taken more than one slot; refund rest. */
1467 u.weapon_slots = slots_required(skill) - 1;
1468 /* It might now be possible to advance some other pending
1469 skill by using the refunded slots, but giving a message
1470 to that effect would seem pretty confusing.... */
1471 }
1472 }
1473}
1474
1475void
1476drain_weapon_skill(int n) /* number of skills to drain */

Callers 1

adjabilFunction · 0.85

Calls 2

slots_requiredFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected