| 1450 | } |
| 1451 | |
| 1452 | void |
| 1453 | lose_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 | |
| 1475 | void |
| 1476 | drain_weapon_skill(int n) /* number of skills to drain */ |
no test coverage detected