… | |
… | |
131 | saves++; |
131 | saves++; |
132 | } |
132 | } |
133 | |
133 | |
134 | if (saves == attacks || attacks == 0) |
134 | if (saves == attacks || attacks == 0) |
135 | return TRUE; |
135 | return TRUE; |
|
|
136 | |
136 | if ((saves == 0) || (rndm (1, attacks) > saves)) |
137 | if (saves == 0 || (rndm (1, attacks) > saves)) |
137 | return FALSE; |
138 | return FALSE; |
|
|
139 | |
138 | return TRUE; |
140 | return TRUE; |
139 | } |
141 | } |
140 | |
142 | |
141 | /* This function calls did_make_save_item. It then performs the |
143 | /* This function calls did_make_save_item. It then performs the |
142 | * appropriate actions to the item (such as burning the item up, |
144 | * appropriate actions to the item (such as burning the item up, |
… | |
… | |
1086 | return 0; |
1088 | return 0; |
1087 | } |
1089 | } |
1088 | |
1090 | |
1089 | if (dam < 0) |
1091 | if (dam < 0) |
1090 | { |
1092 | { |
1091 | LOG (llevError, "hit_player_attacktype called with negative damage: %d\n", dam); |
1093 | LOG (llevError, "hit_player_attacktype called with negative damage %d (hitter %s, target %s)\n", dam, hitter->debug_desc (), op->debug_desc2 ()); |
1092 | return 0; |
1094 | return 0; |
1093 | } |
1095 | } |
1094 | |
1096 | |
1095 | /* AT_INTERNAL is supposed to do exactly dam. Put a case here so |
1097 | /* AT_INTERNAL is supposed to do exactly dam. Put a case here so |
1096 | * people can't mess with that or it otherwise get confused. */ |
1098 | * people can't mess with that or it otherwise get confused. */ |
… | |
… | |
1796 | * in case 0>dam>1, we try to "simulate" a float value-effect */ |
1798 | * in case 0>dam>1, we try to "simulate" a float value-effect */ |
1797 | dam = dam * (100 - op->resist[ATNR_MAGIC]); |
1799 | dam = dam * (100 - op->resist[ATNR_MAGIC]); |
1798 | if (dam >= 100) |
1800 | if (dam >= 100) |
1799 | dam /= 100; |
1801 | dam /= 100; |
1800 | else |
1802 | else |
1801 | dam = (dam > (rndm (0, 99))) ? 1 : 0; |
1803 | dam = (dam > rndm (0, 99)) ? 1 : 0; |
1802 | } |
1804 | } |
1803 | |
1805 | |
1804 | /* AT_CHAOS here is a weapon or monster. Spells are handled by hit_map |
1806 | /* AT_CHAOS here is a weapon or monster. Spells are handled by hit_map |
1805 | * If the attacktype still has chaos, shuffle it, then clear the Chaos bit |
1807 | * If the attacktype still has chaos, shuffle it, then clear the Chaos bit |
1806 | */ |
1808 | */ |
… | |
… | |
1889 | |
1891 | |
1890 | /* basically: maxdam /= area; we try to "simulate" a float |
1892 | /* basically: maxdam /= area; we try to "simulate" a float |
1891 | value-effect */ |
1893 | value-effect */ |
1892 | remainder = 100 * (maxdam % area) / area; |
1894 | remainder = 100 * (maxdam % area) / area; |
1893 | maxdam /= area; |
1895 | maxdam /= area; |
1894 | if (RANDOM () % 100 < remainder) |
1896 | if (rndm (100) < remainder) |
1895 | maxdam++; |
1897 | maxdam++; |
1896 | } |
1898 | } |
1897 | |
1899 | |
1898 | #ifdef ATTACK_DEBUG |
1900 | #ifdef ATTACK_DEBUG |
1899 | LOG (llevDebug, "Attacktype %d did %d damage\n", type, maxdam); |
1901 | LOG (llevDebug, "Attacktype %d did %d damage\n", type, maxdam); |