ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/living.C
(Generate patch)

Comparing deliantra/server/common/living.C (file contents):
Revision 1.112 by root, Sun Mar 28 16:41:45 2010 UTC vs.
Revision 1.113 by root, Sun Mar 28 17:04:37 2010 UTC

820 memcpy (&resist, &arch->resist, sizeof (resist)); 820 memcpy (&resist, &arch->resist, sizeof (resist));
821 821
822 for (int i = 0; i < NROFATTACKS; i++) 822 for (int i = 0; i < NROFATTACKS; i++)
823 { 823 {
824 if (resist[i] > 0) 824 if (resist[i] > 0)
825 prot[i] = resist[i], vuln[i] = 0; 825 prot[i] = resist[i], vuln[i] = 0;
826 else 826 else
827 vuln[i] = -(resist[i]), prot[i] = 0; 827 vuln[i] = -resist[i], prot[i] = 0;
828 828
829 potion_resist[i] = 0; 829 potion_resist[i] = -1000;
830 } 830 }
831 831
832 wc = arch->stats.wc; 832 wc = arch->stats.wc;
833 stats.dam = arch->stats.dam; 833 stats.dam = arch->stats.dam;
834 834
942 * Resistance from potions are treated special as well. If there's 942 * Resistance from potions are treated special as well. If there's
943 * more than one potion-effect, the bigger prot.-value is taken. 943 * more than one potion-effect, the bigger prot.-value is taken.
944 */ 944 */
945 if (tmp->type == POTION_EFFECT) 945 if (tmp->type == POTION_EFFECT)
946 for (int i = 0; i < NROFATTACKS; i++) 946 for (int i = 0; i < NROFATTACKS; i++)
947 {
948 /* Potential for cursed potions, in which case we just can use
949 * a straight MAX, as potion_resist is initialised to zero.
950 // TODO: this is askign for a magic marker optimisation
951 */
952 if (potion_resist[i])
953 max_it (potion_resist[i], tmp->resist[i]); 947 max_it (potion_resist[i], tmp->resist[i]);
954 else
955 potion_resist[i] = tmp->resist[i];
956 }
957 else if (tmp->type != POTION) 948 else if (tmp->type != POTION)
958 for (int i = 0; i < NROFATTACKS; i++) 949 for (int i = 0; i < NROFATTACKS; i++)
959 if (tmp->resist[i] > 0) 950 if (tmp->resist[i] > 0)
960 prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100; 951 prot[i] += ((100 - prot[i]) * tmp->resist[i]) / 100;
961 else if (tmp->resist[i] < 0) 952 else if (tmp->resist[i] < 0)
1166 */ 1157 */
1167 for (int i = 0; i < NROFATTACKS; i++) 1158 for (int i = 0; i < NROFATTACKS; i++)
1168 { 1159 {
1169 resist[i] = prot[i] - vuln[i]; 1160 resist[i] = prot[i] - vuln[i];
1170 1161
1171 if (potion_resist[i] && ((potion_resist[i] > resist[i]) || (potion_resist[i] < 0))) 1162 if (potion_resist[i] != -1000
1163 && (potion_resist[i] > resist[i] || potion_resist[i] < 0))
1172 resist[i] = potion_resist[i]; 1164 resist[i] = potion_resist[i];
1173 } 1165 }
1174 1166
1175 if (type == PLAYER) 1167 if (type == PLAYER)
1176 { 1168 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines