- c = 0;
- else if(player.ammo_cells || player.ammo_shells || player.ammo_plasma || player.ammo_nails || player.ammo_rockets)
- {
- if (rating > 0)
- rating = BOT_PICKUP_RATING_LOW * 0.5 * (1 + rating / BOT_PICKUP_RATING_HIGH);
- // Skilled bots will grab more
- c = 1 + bound(0, skill / 10, 1) * 0.5;
- }
- else
- c = 0;
- }
- else
- c = 1;
-
- if (c <= 0)
- return 0;
-
- // If custom weapon priorities for bots is enabled rate most wanted weapons higher
- if(bot_custom_weapon)
- {
- int best_ratio = 0;
- int missing = 0;
-
- // evaluate weapon usefulness in all ranges
- for(int list = 0; list < 3; list++)
- {
- int position = -1;
- int wep_count = 0;
- int wpn = item.weapon;
- for (int j = 0; j < WEP_LAST; ++j)
- {
- int list_wpn = 0;
- if (list == 0) list_wpn = bot_weapons_far[j];
- else if (list == 1) list_wpn = bot_weapons_mid[j];
- else list_wpn = bot_weapons_close[j];
-
- if (weaponsInMap & Weapons_from(list_wpn).m_wepset) // only if available
- {
- if (list_wpn > 0)
- wep_count++;
- if (position == -1 && list_wpn == wpn)
- position = wep_count;
- }
- }
- if (position == -1)
- {
- missing++;
- position = wep_count; // if missing assume last
- }
- if (wep_count)
- {
- if (!best_ratio || position / wep_count < best_ratio)
- best_ratio = position / wep_count;
- }
- }
-
- if (missing < 3 && best_ratio)
- c = c - best_ratio * 0.3;