will zap/spell/breath attack score a hit against armor class `ac'? */
| 4702 | |
| 4703 | /* will zap/spell/breath attack score a hit against armor class `ac'? */ |
| 4704 | staticfn int |
| 4705 | zap_hit( |
| 4706 | int ac, |
| 4707 | int type) /* either hero cast spell type or 0 */ |
| 4708 | { |
| 4709 | int chance = rn2(20); |
| 4710 | int spell_bonus = type ? spell_hit_bonus(type) : 0; |
| 4711 | |
| 4712 | /* small chance for naked target to avoid being hit */ |
| 4713 | if (!chance) |
| 4714 | return rnd(10) < ac + spell_bonus; |
| 4715 | |
| 4716 | /* very high armor protection does not achieve invulnerability */ |
| 4717 | ac = AC_VALUE(ac); |
| 4718 | |
| 4719 | return (3 - chance < ac + spell_bonus); |
| 4720 | } |
| 4721 | |
| 4722 | staticfn void |
| 4723 | disintegrate_mon( |
no test coverage detected