* Generate the to-hit bonus for a spell. Based on the hero's skill in * spell class and dexterity. */
| 3506 | * spell class and dexterity. |
| 3507 | */ |
| 3508 | staticfn int |
| 3509 | spell_hit_bonus(int skill) |
| 3510 | { |
| 3511 | int hit_bon = 0; |
| 3512 | int dex = ACURR(A_DEX); |
| 3513 | |
| 3514 | switch (P_SKILL(spell_skilltype(skill))) { |
| 3515 | case P_ISRESTRICTED: |
| 3516 | case P_UNSKILLED: |
| 3517 | hit_bon = -4; |
| 3518 | break; |
| 3519 | case P_BASIC: |
| 3520 | hit_bon = 0; |
| 3521 | break; |
| 3522 | case P_SKILLED: |
| 3523 | hit_bon = 2; |
| 3524 | break; |
| 3525 | case P_EXPERT: |
| 3526 | hit_bon = 3; |
| 3527 | break; |
| 3528 | } |
| 3529 | |
| 3530 | if (dex < 4) |
| 3531 | hit_bon -= 3; |
| 3532 | else if (dex < 6) |
| 3533 | hit_bon -= 2; |
| 3534 | else if (dex < 8) |
| 3535 | hit_bon -= 1; |
| 3536 | else if (dex < 14) |
| 3537 | /* Will change when print stuff below removed */ |
| 3538 | hit_bon -= 0; |
| 3539 | else |
| 3540 | /* Even increment for dexterous heroes (see weapon.c abon) */ |
| 3541 | hit_bon += dex - 14; |
| 3542 | |
| 3543 | return hit_bon; |
| 3544 | } |
| 3545 | |
| 3546 | const char * |
| 3547 | exclam(int force) |
no test coverage detected