… | |
… | |
1062 | val += (item->magic - other_weap->magic) * 3; |
1062 | val += (item->magic - other_weap->magic) * 3; |
1063 | /* Monsters don't really get benefits from things like regen rates |
1063 | /* Monsters don't really get benefits from things like regen rates |
1064 | * from items. But the bonus for their stats are very important. |
1064 | * from items. But the bonus for their stats are very important. |
1065 | */ |
1065 | */ |
1066 | for (i = 0; i < NUM_STATS; i++) |
1066 | for (i = 0; i < NUM_STATS; i++) |
1067 | val += (get_attr_value (&item->stats, i) - get_attr_value (&other_weap->stats, i)) * 2; |
1067 | val += item->stats.stat (i) - other_weap->stats.stat (i) * 2; |
1068 | |
1068 | |
1069 | if (val > 0) |
1069 | if (val > 0) |
1070 | return 1; |
1070 | return 1; |
1071 | else |
1071 | else |
1072 | return 0; |
1072 | return 0; |
… | |
… | |
1076 | check_good_armour (object *who, object *item) |
1076 | check_good_armour (object *who, object *item) |
1077 | { |
1077 | { |
1078 | object *other_armour; |
1078 | object *other_armour; |
1079 | int val = 0, i; |
1079 | int val = 0, i; |
1080 | |
1080 | |
1081 | for (other_armour = who->inv; other_armour != NULL; other_armour = other_armour->below) |
1081 | for (other_armour = who->inv; other_armour; other_armour = other_armour->below) |
1082 | if (other_armour->type == item->type && QUERY_FLAG (other_armour, FLAG_APPLIED)) |
1082 | if (other_armour->type == item->type && QUERY_FLAG (other_armour, FLAG_APPLIED)) |
1083 | break; |
1083 | break; |
1084 | |
1084 | |
1085 | if (other_armour == NULL) /* No other armour, use the new */ |
1085 | if (other_armour == NULL) /* No other armour, use the new */ |
1086 | return 1; |
1086 | return 1; |