fix: do not buy armor & grenades in eco rounds. (fixes #108)
This commit is contained in:
parent
66688ebe4a
commit
94ffdc022c
1 changed files with 20 additions and 18 deletions
|
|
@ -1313,7 +1313,7 @@ void Bot::buyStuff () {
|
||||||
auto tab = conf.getRawWeapons ();
|
auto tab = conf.getRawWeapons ();
|
||||||
|
|
||||||
const bool isPistolMode = tab[25].teamStandard == -1 && tab[3].teamStandard == 2;
|
const bool isPistolMode = tab[25].teamStandard == -1 && tab[3].teamStandard == 2;
|
||||||
const bool teamEcoValid = bots.checkTeamEco (m_team);
|
const bool teamHasGoodEconomics = bots.checkTeamEco (m_team);
|
||||||
|
|
||||||
// do this, because xash engine is not capable to run all the features goldsrc, but we have cs 1.6 on it, so buy table must be the same
|
// do this, because xash engine is not capable to run all the features goldsrc, but we have cs 1.6 on it, so buy table must be the same
|
||||||
const bool isOldGame = game.is (GameFlags::Legacy) && !game.is (GameFlags::Xash3D);
|
const bool isOldGame = game.is (GameFlags::Legacy) && !game.is (GameFlags::Xash3D);
|
||||||
|
|
@ -1323,7 +1323,7 @@ void Bot::buyStuff () {
|
||||||
|
|
||||||
switch (m_buyState) {
|
switch (m_buyState) {
|
||||||
case BuyState::PrimaryWeapon: // if no primary weapon and bot has some money, buy a primary weapon
|
case BuyState::PrimaryWeapon: // if no primary weapon and bot has some money, buy a primary weapon
|
||||||
if ((!hasShield () && !hasPrimaryWeapon () && teamEcoValid) || (teamEcoValid && canReplaceWeapon ())) {
|
if ((!hasShield () && !hasPrimaryWeapon () && teamHasGoodEconomics) || (teamHasGoodEconomics && canReplaceWeapon ())) {
|
||||||
int moneySave = 0;
|
int moneySave = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -1501,7 +1501,7 @@ void Bot::buyStuff () {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuyState::ArmorVestHelm: // if armor is damaged and bot has some money, buy some armor
|
case BuyState::ArmorVestHelm: // if armor is damaged and bot has some money, buy some armor
|
||||||
if (pev->armorvalue < rg.int_ (50, 80) && (isPistolMode || (teamEcoValid && hasPrimaryWeapon ()))) {
|
if (pev->armorvalue < rg.int_ (50, 80) && teamHasGoodEconomics && (isPistolMode || (teamHasGoodEconomics && hasPrimaryWeapon ()))) {
|
||||||
// if bot is rich, buy kevlar + helmet, else buy a single kevlar
|
// if bot is rich, buy kevlar + helmet, else buy a single kevlar
|
||||||
if (m_moneyAmount > 1500 && !isWeaponRestricted (Weapon::ArmorHelm)) {
|
if (m_moneyAmount > 1500 && !isWeaponRestricted (Weapon::ArmorHelm)) {
|
||||||
issueCommand ("buyequip;menuselect 2");
|
issueCommand ("buyequip;menuselect 2");
|
||||||
|
|
@ -1609,22 +1609,24 @@ void Bot::buyStuff () {
|
||||||
|
|
||||||
case BuyState::Grenades: // if bot has still some money, choose if bot should buy a grenade or not
|
case BuyState::Grenades: // if bot has still some money, choose if bot should buy a grenade or not
|
||||||
|
|
||||||
// buy a he grenade
|
if (teamHasGoodEconomics) {
|
||||||
if (conf.chanceToBuyGrenade (0) && m_moneyAmount >= 400 && !isWeaponRestricted (Weapon::Explosive)) {
|
// buy a he grenade
|
||||||
issueCommand ("buyequip");
|
if (conf.chanceToBuyGrenade (0) && m_moneyAmount >= 400 && !isWeaponRestricted (Weapon::Explosive)) {
|
||||||
issueCommand ("menuselect 4");
|
issueCommand ("buyequip");
|
||||||
}
|
issueCommand ("menuselect 4");
|
||||||
|
}
|
||||||
|
|
||||||
// buy a concussion grenade, i.e., 'flashbang'
|
// buy a concussion grenade, i.e., 'flashbang'
|
||||||
if (conf.chanceToBuyGrenade (1) && m_moneyAmount >= 300 && teamEcoValid && !isWeaponRestricted (Weapon::Flashbang)) {
|
if (conf.chanceToBuyGrenade (1) && m_moneyAmount >= 300 && teamHasGoodEconomics && !isWeaponRestricted (Weapon::Flashbang)) {
|
||||||
issueCommand ("buyequip");
|
issueCommand ("buyequip");
|
||||||
issueCommand ("menuselect 3");
|
issueCommand ("menuselect 3");
|
||||||
}
|
}
|
||||||
|
|
||||||
// buy a smoke grenade
|
// buy a smoke grenade
|
||||||
if (conf.chanceToBuyGrenade (2) && m_moneyAmount >= 400 && teamEcoValid && !isWeaponRestricted (Weapon::Smoke)) {
|
if (conf.chanceToBuyGrenade (2) && m_moneyAmount >= 400 && teamHasGoodEconomics && !isWeaponRestricted (Weapon::Smoke)) {
|
||||||
issueCommand ("buyequip");
|
issueCommand ("buyequip");
|
||||||
issueCommand ("menuselect 5");
|
issueCommand ("menuselect 5");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1640,7 +1642,7 @@ void Bot::buyStuff () {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuyState::NightVision:
|
case BuyState::NightVision:
|
||||||
if (m_moneyAmount > 2500 && !m_hasNVG && rg.chance (30) && m_path) {
|
if (teamHasGoodEconomics && m_moneyAmount > 2500 && !m_hasNVG && rg.chance (30) && m_path) {
|
||||||
float skyColor = illum.getSkyColor ();
|
float skyColor = illum.getSkyColor ();
|
||||||
float lightLevel = m_path->light;
|
float lightLevel = m_path->light;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue